/usr/src/kernel-patches/lustre/patches/iallocsem_consistency.patch is in linux-patch-lustre 1.8.5+dfsg-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | Index: linux-2.6.9/fs/attr.c
===================================================================
--- linux-2.6.9/fs.orig/attr.c 2006-03-10 17:20:39.000000000 +0200
+++ linux-2.6.9/fs/attr.c 2006-04-09 01:21:44.000000000 +0300
@@ -177,6 +177,9 @@
if (!attr->ia_valid)
return 0;
+ if (ia_valid & ATTR_SIZE)
+ down_write(&dentry->d_inode->i_alloc_sem);
+
if (inode->i_op && inode->i_op->setattr) {
audit_notify_watch(inode, MAY_WRITE);
error = security_inode_setattr(dentry, attr);
@@ -194,6 +197,10 @@
error = inode_setattr(inode, attr);
}
}
+
+ if (ia_valid & ATTR_SIZE)
+ up_write(&dentry->d_inode->i_alloc_sem);
+
if (!error) {
unsigned long dn_mask = setattr_mask(ia_valid);
if (dn_mask)
Index: linux-2.6.9/fs/open.c
===================================================================
--- linux-2.6.9/fs.orig/open.c 2006-04-09 01:18:08.000000000 +0300
+++ linux-2.6.9/fs/open.c 2006-04-09 01:22:29.000000000 +0300
@@ -205,16 +205,16 @@
newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
down(&dentry->d_inode->i_sem);
- down_write(&dentry->d_inode->i_alloc_sem);
if (called_from_open)
newattrs.ia_valid |= ATTR_FROM_OPEN;
if (op->setattr_raw) {
newattrs.ia_valid |= ATTR_RAW;
newattrs.ia_ctime = CURRENT_TIME;
+ down_write(&dentry->d_inode->i_alloc_sem);
err = op->setattr_raw(dentry->d_inode, &newattrs);
+ up_write(&dentry->d_inode->i_alloc_sem);
} else
err = notify_change(dentry, &newattrs);
- up_write(&dentry->d_inode->i_alloc_sem);
up(&dentry->d_inode->i_sem);
return err;
}
|