This allows a vfsmount to keep track of how many instances of files open for write there are at a given time. This will be useful if it is ever desired to change a mount from r/w to r/o at runtime. A mount can also potentially refuse to allow writers; this is why mnt_want_write() has a return value. However, that functionality will be added later in the series. For now, always allow new writers. Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx> --- lxc-dave/fs/namespace.c | 1 + lxc-dave/include/linux/mount.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff -puN fs/namespace.c~convert-permission-to-file-and-vfs fs/namespace.c --- lxc/fs/namespace.c~convert-permission-to-file-and-vfs 2006-06-07 16:53:11.000000000 -0700 +++ lxc-dave/fs/namespace.c 2006-06-07 16:53:11.000000000 -0700 @@ -66,6 +66,7 @@ struct vfsmount *alloc_vfsmnt(const char if (mnt) { memset(mnt, 0, sizeof(struct vfsmount)); atomic_set(&mnt->mnt_count, 1); + /* atomic_set(&mnt->writer_count, 0); */ INIT_LIST_HEAD(&mnt->mnt_hash); INIT_LIST_HEAD(&mnt->mnt_child); INIT_LIST_HEAD(&mnt->mnt_mounts); diff -puN include/linux/mount.h~convert-permission-to-file-and-vfs include/linux/mount.h --- lxc/include/linux/mount.h~convert-permission-to-file-and-vfs 2006-06-07 16:53:11.000000000 -0700 +++ lxc-dave/include/linux/mount.h 2006-06-07 16:53:11.000000000 -0700 @@ -12,6 +12,8 @@ #define _LINUX_MOUNT_H #ifdef __KERNEL__ +#include <linux/err.h> +#include <linux/fs.h> #include <linux/types.h> #include <linux/list.h> #include <linux/spinlock.h> @@ -38,6 +40,7 @@ struct vfsmount { struct list_head mnt_mounts; /* list of children, anchored here */ struct list_head mnt_child; /* and going through their mnt_child */ atomic_t mnt_count; + atomic_t mnt_writers; int mnt_flags; int mnt_expiry_mark; /* true if marked for expiry */ char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ @@ -58,6 +61,17 @@ static inline struct vfsmount *mntget(st return mnt; } +static inline int mnt_want_write(struct vfsmount *mnt) +{ + atomic_inc(&mnt->mnt_writers); + return 0; +} + +static inline void mnt_drop_write(struct vfsmount *mnt) +{ + atomic_dec(&mnt->mnt_writers); +} + extern void mntput_no_expire(struct vfsmount *mnt); extern void mnt_pin(struct vfsmount *mnt); extern void mnt_unpin(struct vfsmount *mnt); diff -L convert-permission-to-file-and-vfs -puN /dev/null /dev/null diff -L convert-permission-to-file-and-vfs.patch -puN /dev/null /dev/null _ - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html