Whamcloud - gitweb
adding 2.6-sles10 target and kernel config files for the sles10 kernel
[fs/lustre-release.git] / lustre / kernel_patches / patches / iallocsem_consistency.patch
1 Index: linux-2.6.9/fs/attr.c
2 ===================================================================
3 --- linux-2.6.9/fs.orig/attr.c  2006-03-10 17:20:39.000000000 +0200
4 +++ linux-2.6.9/fs/attr.c       2006-04-09 01:21:44.000000000 +0300
5 @@ -177,6 +177,9 @@
6         if (!attr->ia_valid)
7                 return 0;
8  
9 +        if (ia_valid & ATTR_SIZE)
10 +                down_write(&dentry->d_inode->i_alloc_sem);
11 +
12         if (inode->i_op && inode->i_op->setattr) {
13                 audit_notify_watch(inode, MAY_WRITE);
14                 error = security_inode_setattr(dentry, attr);
15 @@ -194,6 +197,10 @@
16                                 error = inode_setattr(inode, attr);
17                 }
18         }
19 +
20 +        if (ia_valid & ATTR_SIZE)
21 +                up_write(&dentry->d_inode->i_alloc_sem);
22 +
23         if (!error) {
24                 unsigned long dn_mask = setattr_mask(ia_valid);
25                 if (dn_mask)
26 Index: linux-2.6.9/fs/open.c
27 ===================================================================
28 --- linux-2.6.9/fs.orig/open.c  2006-04-09 01:18:08.000000000 +0300
29 +++ linux-2.6.9/fs/open.c       2006-04-09 01:22:29.000000000 +0300
30 @@ -205,16 +205,16 @@
31         newattrs.ia_size = length;
32         newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
33         down(&dentry->d_inode->i_sem);
34 -       down_write(&dentry->d_inode->i_alloc_sem);
35         if (called_from_open)
36                 newattrs.ia_valid |= ATTR_FROM_OPEN;
37         if (op->setattr_raw) {
38                 newattrs.ia_valid |= ATTR_RAW;
39                 newattrs.ia_ctime = CURRENT_TIME;
40 +               down_write(&dentry->d_inode->i_alloc_sem);
41                 err = op->setattr_raw(dentry->d_inode, &newattrs);
42 +               up_write(&dentry->d_inode->i_alloc_sem);
43         } else
44                 err = notify_change(dentry, &newattrs);
45 -       up_write(&dentry->d_inode->i_alloc_sem);
46         up(&dentry->d_inode->i_sem);
47         return err;
48  }