1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] vfs: restore ia_file for compatibility with external modules
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.
10 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
12 fs/attr.c | 13 ++++++++++++-
13 include/linux/fs.h | 11 +++++++++++
14 2 files changed, 23 insertions(+), 1 deletion(-)
18 @@ -168,8 +168,19 @@ int fnotify_change(struct dentry *dentry
20 if (file && file->f_op && file->f_op->fsetattr)
21 error = file->f_op->fsetattr(file, attr);
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. */
31 + attr->ia_valid |= ATTR_FILE;
32 + attr->ia_file = file;
34 error = inode->i_op->setattr(dentry, attr);
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;
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).
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.
55 + struct file *ia_file;