~mathiaz/apparmor/ubuntu-mathiaz

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/vfs-notify_change.diff

  • Committer: Mathias Gug
  • Date: 2008-02-04 18:57:00 UTC
  • mfrom: (885.1.5 apparmor)
  • Revision ID: mathiaz@ubuntu.com-20080204185700-wwlyq0ksssxclv8w
Merge  ubuntu branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 fs/exec.c           |    3 ++-
16
16
 fs/fat/file.c       |    2 +-
17
17
 fs/hpfs/namei.c     |    2 +-
18
 
 fs/namei.c          |    3 ++-
 
18
 fs/namei.c          |    2 +-
19
19
 fs/nfsd/vfs.c       |    8 ++++----
20
20
 fs/open.c           |   28 +++++++++++++++-------------
21
21
 fs/reiserfs/xattr.c |    6 +++---
24
24
 include/linux/fs.h  |    6 +++---
25
25
 mm/filemap.c        |    2 +-
26
26
 mm/tiny-shmem.c     |    2 +-
27
 
 14 files changed, 45 insertions(+), 37 deletions(-)
 
27
 14 files changed, 44 insertions(+), 37 deletions(-)
28
28
 
29
29
--- a/fs/attr.c
30
30
+++ b/fs/attr.c
37
37
+                 struct iattr *attr)
38
38
 {
39
39
        struct inode *inode = dentry->d_inode;
40
 
        mode_t mode;
 
40
        mode_t mode = inode->i_mode;
41
41
--- a/fs/ecryptfs/inode.c
42
42
+++ b/fs/ecryptfs/inode.c
43
 
@@ -889,6 +889,7 @@ static int ecryptfs_setattr(struct dentr
 
43
@@ -862,6 +862,7 @@ static int ecryptfs_setattr(struct dentr
44
44
 {
45
45
        int rc = 0;
46
46
        struct dentry *lower_dentry;
48
48
        struct inode *inode;
49
49
        struct inode *lower_inode;
50
50
        struct ecryptfs_crypt_stat *crypt_stat;
51
 
@@ -899,6 +900,7 @@ static int ecryptfs_setattr(struct dentr
 
51
@@ -872,6 +873,7 @@ static int ecryptfs_setattr(struct dentr
52
52
        inode = dentry->d_inode;
53
53
        lower_inode = ecryptfs_inode_to_lower(inode);
54
54
        lower_dentry = ecryptfs_dentry_to_lower(dentry);
56
56
        mutex_lock(&crypt_stat->cs_mutex);
57
57
        if (S_ISDIR(dentry->d_inode->i_mode))
58
58
                crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
59
 
@@ -955,7 +957,7 @@ static int ecryptfs_setattr(struct dentr
60
 
                if (rc < 0)
61
 
                        goto out;
62
 
        }
 
59
@@ -922,7 +924,7 @@ static int ecryptfs_setattr(struct dentr
 
60
        if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
 
61
                ia->ia_valid &= ~ATTR_MODE;
 
62
 
63
63
-       rc = notify_change(lower_dentry, ia);
64
64
+       rc = notify_change(lower_dentry, lower_mnt, ia);
65
65
 out:
67
67
        return rc;
68
68
--- a/fs/exec.c
69
69
+++ b/fs/exec.c
70
 
@@ -1796,7 +1796,8 @@ int do_coredump(long signr, int exit_cod
 
70
@@ -1784,7 +1784,8 @@ int do_coredump(long signr, int exit_cod
71
71
                goto close_fail;
72
72
        if (!file->f_op->write)
73
73
                goto close_fail;
76
76
+           do_truncate(file->f_path.dentry, file->f_path.mnt, 0, 0, file) != 0)
77
77
                goto close_fail;
78
78
 
79
 
        retval = binfmt->core_dump(signr, regs, file);
 
79
        retval = binfmt->core_dump(signr, regs, file, core_limit);
80
80
--- a/fs/fat/file.c
81
81
+++ b/fs/fat/file.c
82
82
@@ -92,7 +92,7 @@ int fat_generic_ioctl(struct inode *inod
101
101
                                goto again;
102
102
--- a/fs/namei.c
103
103
+++ b/fs/namei.c
104
 
@@ -1631,7 +1631,8 @@ int may_open(struct nameidata *nd, int a
 
104
@@ -1660,7 +1660,7 @@ int may_open(struct nameidata *nd, int a
105
105
                if (!error) {
106
106
                        DQUOT_INIT(inode);
107
 
                        
108
 
-                       error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL);
 
107
 
 
108
-                       error = do_truncate(dentry, 0,
109
109
+                       error = do_truncate(dentry, nd->mnt, 0,
110
 
+                                           ATTR_MTIME|ATTR_CTIME, NULL);
 
110
                                            ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
 
111
                                            NULL);
111
112
                }
112
 
                put_write_access(inode);
113
 
                if (error)
114
113
--- a/fs/nfsd/vfs.c
115
114
+++ b/fs/nfsd/vfs.c
116
 
@@ -375,7 +375,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 
115
@@ -388,7 +388,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
117
116
        err = nfserr_notsync;
118
117
        if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
119
118
                fh_lock(fhp);
122
121
                err = nfserrno(host_err);
123
122
                fh_unlock(fhp);
124
123
        }
125
 
@@ -918,13 +918,13 @@ out:
 
124
@@ -943,13 +943,13 @@ out:
126
125
        return err;
127
126
 }
128
127
 
130
129
+static void kill_suid(struct dentry *dentry, struct vfsmount *mnt)
131
130
 {
132
131
        struct iattr    ia;
133
 
        ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID;
 
132
        ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
134
133
 
135
134
        mutex_lock(&dentry->d_inode->i_mutex);
136
135
-       notify_change(dentry, &ia);
138
137
        mutex_unlock(&dentry->d_inode->i_mutex);
139
138
 }
140
139
 
141
 
@@ -983,7 +983,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
 
140
@@ -1008,7 +1008,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
142
141
 
143
142
        /* clear setuid/setgid flag after write */
144
143
        if (host_err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID)))
169
168
        mutex_unlock(&dentry->d_inode->i_mutex);
170
169
        return err;
171
170
 }
172
 
@@ -270,7 +270,7 @@ static long do_sys_truncate(const char _
 
171
@@ -271,7 +271,7 @@ static long do_sys_truncate(const char _
173
172
        error = locks_verify_truncate(inode, NULL, length);
174
173
        if (!error) {
175
174
                DQUOT_INIT(inode);
176
175
-               error = do_truncate(nd.dentry, length, 0, NULL);
177
176
+               error = do_truncate(nd.dentry, nd.mnt, length, 0, NULL);
178
177
        }
179
 
        put_write_access(inode);
180
178
 
181
 
@@ -322,7 +322,8 @@ static long do_sys_ftruncate(unsigned in
 
179
 put_write_and_out:
 
180
@@ -324,7 +324,8 @@ static long do_sys_ftruncate(unsigned in
182
181
 
183
182
        error = locks_verify_truncate(inode, file, length);
184
183
        if (!error)
188
187
 out_putf:
189
188
        fput(file);
190
189
 out:
191
 
@@ -580,7 +581,7 @@ asmlinkage long sys_fchmod(unsigned int 
 
190
@@ -582,7 +583,7 @@ asmlinkage long sys_fchmod(unsigned int 
192
191
                mode = inode->i_mode;
193
192
        newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
194
193
        newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
197
196
        mutex_unlock(&inode->i_mutex);
198
197
 
199
198
 out_putf:
200
 
@@ -615,7 +616,7 @@ asmlinkage long sys_fchmodat(int dfd, co
 
199
@@ -617,7 +618,7 @@ asmlinkage long sys_fchmodat(int dfd, co
201
200
                mode = inode->i_mode;
202
201
        newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
203
202
        newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
206
205
        mutex_unlock(&inode->i_mutex);
207
206
 
208
207
 dput_and_out:
209
 
@@ -629,7 +630,8 @@ asmlinkage long sys_chmod(const char __u
 
208
@@ -631,7 +632,8 @@ asmlinkage long sys_chmod(const char __u
210
209
        return sys_fchmodat(AT_FDCWD, filename, mode);
211
210
 }
212
211
 
216
215
 {
217
216
        struct inode * inode;
218
217
        int error;
219
 
@@ -658,7 +660,7 @@ static int chown_common(struct dentry * 
220
 
        if (!S_ISDIR(inode->i_mode))
221
 
                newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
 
218
@@ -661,7 +663,7 @@ static int chown_common(struct dentry * 
 
219
                newattrs.ia_valid |=
 
220
                        ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
222
221
        mutex_lock(&inode->i_mutex);
223
222
-       error = notify_change(dentry, &newattrs);
224
223
+       error = notify_change(dentry, mnt, &newattrs);
225
224
        mutex_unlock(&inode->i_mutex);
226
225
 out:
227
226
        return error;
228
 
@@ -672,7 +674,7 @@ asmlinkage long sys_chown(const char __u
 
227
@@ -675,7 +677,7 @@ asmlinkage long sys_chown(const char __u
229
228
        error = user_path_walk(filename, &nd);
230
229
        if (error)
231
230
                goto out;
234
233
        path_release(&nd);
235
234
 out:
236
235
        return error;
237
 
@@ -692,7 +694,7 @@ asmlinkage long sys_fchownat(int dfd, co
 
236
@@ -695,7 +697,7 @@ asmlinkage long sys_fchownat(int dfd, co
238
237
        error = __user_walk_fd(dfd, filename, follow, &nd);
239
238
        if (error)
240
239
                goto out;
243
242
        path_release(&nd);
244
243
 out:
245
244
        return error;
246
 
@@ -706,7 +708,7 @@ asmlinkage long sys_lchown(const char __
 
245
@@ -709,7 +711,7 @@ asmlinkage long sys_lchown(const char __
247
246
        error = user_path_walk_link(filename, &nd);
248
247
        if (error)
249
248
                goto out;
252
251
        path_release(&nd);
253
252
 out:
254
253
        return error;
255
 
@@ -725,7 +727,7 @@ asmlinkage long sys_fchown(unsigned int 
 
254
@@ -728,7 +730,7 @@ asmlinkage long sys_fchown(unsigned int 
256
255
 
257
256
        dentry = file->f_path.dentry;
258
 
        audit_inode(NULL, dentry->d_inode);
 
257
        audit_inode(NULL, dentry);
259
258
-       error = chown_common(dentry, user, group);
260
259
+       error = chown_common(dentry, file->f_path.mnt, user, group);
261
260
        fput(file);
263
262
        return error;
264
263
--- a/fs/reiserfs/xattr.c
265
264
+++ b/fs/reiserfs/xattr.c
266
 
@@ -479,7 +479,7 @@ reiserfs_xattr_set(struct inode *inode, 
 
265
@@ -485,7 +485,7 @@ reiserfs_xattr_set(struct inode *inode, 
267
266
        newattrs.ia_size = buffer_size;
268
267
        newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
269
 
        mutex_lock(&xinode->i_mutex);
 
268
        mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
270
269
-       err = notify_change(fp->f_path.dentry, &newattrs);
271
270
+       err = notify_change(fp->f_path.dentry, NULL, &newattrs);
272
271
        if (err)
273
272
                goto out_filp;
274
273
 
275
 
@@ -819,7 +819,7 @@ reiserfs_chown_xattrs_filler(void *buf, 
 
274
@@ -825,7 +825,7 @@ reiserfs_chown_xattrs_filler(void *buf, 
276
275
        }
277
276
 
278
277
        if (!S_ISDIR(xafile->d_inode->i_mode))
279
278
-               err = notify_change(xafile, attrs);
280
 
+               err = notify_change(xafile, NULL, attrs);
 
279
+           err = notify_change(xafile, NULL, attrs);
281
280
        dput(xafile);
282
281
 
283
282
        return err;
284
 
@@ -871,7 +871,7 @@ int reiserfs_chown_xattrs(struct inode *
 
283
@@ -877,7 +877,7 @@ int reiserfs_chown_xattrs(struct inode *
285
284
                goto out_dir;
286
285
        }
287
286
 
292
291
       out_dir:
293
292
--- a/fs/sysfs/file.c
294
293
+++ b/fs/sysfs/file.c
295
 
@@ -524,7 +524,7 @@ int sysfs_chmod_file(struct kobject *kob
296
 
        mutex_lock(&inode->i_mutex);
 
294
@@ -610,7 +610,7 @@ int sysfs_chmod_file(struct kobject *kob
 
295
 
297
296
        newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
298
297
        newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
299
298
-       rc = notify_change(victim, &newattrs);
300
299
+       rc = notify_change(victim, NULL, &newattrs);
301
 
        mutex_unlock(&inode->i_mutex);
302
 
  out:
303
 
        dput(victim);
 
300
 
 
301
        if (rc == 0) {
 
302
                mutex_lock(&sysfs_mutex);
304
303
--- a/fs/utimes.c
305
304
+++ b/fs/utimes.c
306
 
@@ -46,7 +46,7 @@ long do_utimes(int dfd, char __user *fil
 
305
@@ -54,7 +54,7 @@ long do_utimes(int dfd, char __user *fil
307
306
 {
308
307
        int error;
309
308
        struct nameidata nd;
312
311
        struct inode *inode;
313
312
        struct iattr newattrs;
314
313
        struct file *f = NULL;
315
 
@@ -64,16 +64,17 @@ long do_utimes(int dfd, char __user *fil
 
314
@@ -77,16 +77,17 @@ long do_utimes(int dfd, char __user *fil
316
315
                f = fget(dfd);
317
316
                if (!f)
318
317
                        goto out;
333
332
 
334
333
        error = -EROFS;
335
334
        if (IS_RDONLY(inode))
336
 
@@ -118,7 +119,7 @@ long do_utimes(int dfd, char __user *fil
 
335
@@ -131,7 +132,7 @@ long do_utimes(int dfd, char __user *fil
337
336
                }
338
337
        }
339
338
        mutex_lock(&inode->i_mutex);
344
343
        if (f)
345
344
--- a/include/linux/fs.h
346
345
+++ b/include/linux/fs.h
347
 
@@ -1404,8 +1404,8 @@ static inline int break_lease(struct ino
 
346
@@ -1536,8 +1536,8 @@ static inline int break_lease(struct ino
348
347
 
349
348
 /* fs/open.c */
350
349
 
352
351
-                      struct file *filp);
353
352
+extern int do_truncate(struct dentry *, struct vfsmount *, loff_t start,
354
353
+                      unsigned int time_attrs, struct file *filp);
355
 
 extern long do_sys_open(int fdf, const char __user *filename, int flags,
 
354
 extern long do_sys_open(int dfd, const char __user *filename, int flags,
356
355
                        int mode);
357
356
 extern struct file *filp_open(const char *, int, int);
358
 
@@ -1561,7 +1561,7 @@ extern int do_remount_sb(struct super_bl
 
357
@@ -1693,7 +1693,7 @@ extern int do_remount_sb(struct super_bl
359
358
 #ifdef CONFIG_BLOCK
360
359
 extern sector_t bmap(struct inode *, sector_t);
361
360
 #endif
366
365
                int (*check_acl)(struct inode *, int));
367
366
--- a/mm/filemap.c
368
367
+++ b/mm/filemap.c
369
 
@@ -1696,7 +1696,7 @@ int __remove_suid(struct path *path, int
 
368
@@ -1615,7 +1615,7 @@ int __remove_suid(struct path *path, int
370
369
        struct iattr newattrs;
371
370
 
372
371
        newattrs.ia_valid = ATTR_FORCE | kill;
377
376
 int remove_suid(struct path *path)
378
377
--- a/mm/tiny-shmem.c
379
378
+++ b/mm/tiny-shmem.c
380
 
@@ -86,7 +86,7 @@ struct file *shmem_file_setup(char *name
381
 
        file->f_mode = FMODE_WRITE | FMODE_READ;
 
379
@@ -81,7 +81,7 @@ struct file *shmem_file_setup(char *name
 
380
        inode->i_nlink = 0;     /* It is unlinked */
382
381
 
383
382
        /* notify everyone as to the change of file size */
384
383
-       error = do_truncate(dentry, size, 0, file);