[PATCH 19/22] elevate writer count for custom struct_file

Dave Hansen
2007-02-09T22:58:49Z

Some filesystems forego the use of normal vfs calls to create
struct files. Make sure that these users elevate the mnt writer
count. These probably don't have any real meaning because there
is no real backing store for these mounts, but it is here for
consistency.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

lxc-dave/fs/file_table.c | 4 ++++
1 file changed, 4 insertions(+)

diff -puN fs/file_table.c~22-24-elevate-writer-count-for-custom-struct-file fs/file_table.c
--- lxc/fs/file_table.c~22-24-elevate-writer-count-for-custom-struct-file 2007-02-09 14:26:59.000000000 -0800
+++ lxc-dave/fs/file_table.c 2007-02-09 14:26:59.000000000 -0800
@@ -171,6 +171,10 @@ int init_file(struct file *file, struct
file->f_mapping = dentry->d_inode->i_mapping;
file->f_mode = mode;
file->f_op = fop;
+ if (mode & FMODE_WRITE) {
+ error = mnt_want_write(mnt);
+ WARN_ON(error);
+ }
return error;
}

_