]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.apparmor/fsetattr-restore-ia_file.diff
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.apparmor / fsetattr-restore-ia_file.diff
1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] vfs: restore ia_file for compatibility with external modules
3 References: bnc#381259
4
5 patches.apparmor/fsetattr.diff eliminated ia_file and ATTR_FILE in favor
6 of providing a ->fsetattr call that used a file pointer. Until this
7 patch is accepted into mainline, this patch provides the backward
8 compatibility for external file system modules.
9
10 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
11 ---
12 fs/attr.c | 13 ++++++++++++-
13 include/linux/fs.h | 11 +++++++++++
14 2 files changed, 23 insertions(+), 1 deletion(-)
15
16 --- a/fs/attr.c
17 +++ b/fs/attr.c
18 @@ -168,8 +168,19 @@ int fnotify_change(struct dentry *dentry
19 if (!error) {
20 if (file && file->f_op && file->f_op->fsetattr)
21 error = file->f_op->fsetattr(file, attr);
22 - else
23 + else {
24 + /* External file system still expect to be
25 + * passed a file pointer via ia_file and
26 + * have it announced via ATTR_FILE. This
27 + * just makes it so they don't need to
28 + * change their API just for us. External
29 + * callers will have set these themselves. */
30 + if (file) {
31 + attr->ia_valid |= ATTR_FILE;
32 + attr->ia_file = file;
33 + }
34 error = inode->i_op->setattr(dentry, attr);
35 + }
36 }
37 } else {
38 error = inode_change_ok(inode, attr);
39 --- a/include/linux/fs.h
40 +++ b/include/linux/fs.h
41 @@ -367,6 +367,17 @@ struct iattr {
42 struct timespec ia_atime;
43 struct timespec ia_mtime;
44 struct timespec ia_ctime;
45 +
46 + /*
47 + * Not an attribute, but an auxilary info for filesystems wanting to
48 + * implement an ftruncate() like method. NOTE: filesystem should
49 + * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL).
50 + *
51 + * NOTE: With patches.apparmor/fsetattr.diff applied, this is
52 + * for compatibility with external file system modules only. There
53 + * should not be any in-kernel users left.
54 + */
55 + struct file *ia_file;
56 };
57
58 /*