Signed-off-by: Dave Hansen <[EMAIL PROTECTED]> --- linux-2.6.git-dave/fs/open.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff -puN fs/open.c~r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate fs/open.c --- linux-2.6.git/fs/open.c~r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate 2008-02-08 13:04:57.000000000 -0800 +++ linux-2.6.git-dave/fs/open.c 2008-02-08 13:04:57.000000000 -0800 @@ -244,21 +244,21 @@ static long do_sys_truncate(const char _ if (!S_ISREG(inode->i_mode)) goto dput_and_out; - error = vfs_permission(&nd, MAY_WRITE); + error = mnt_want_write(nd.mnt); if (error) goto dput_and_out; - error = -EROFS; - if (IS_RDONLY(inode)) - goto dput_and_out; + error = vfs_permission(&nd, MAY_WRITE); + if (error) + goto mnt_drop_write_and_out; error = -EPERM; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto dput_and_out; + goto mnt_drop_write_and_out; error = get_write_access(inode); if (error) - goto dput_and_out; + goto mnt_drop_write_and_out; /* * Make sure that there are no leases. get_write_access() protects @@ -276,6 +276,8 @@ static long do_sys_truncate(const char _ put_write_and_out: put_write_access(inode); +mnt_drop_write_and_out: + mnt_drop_write(nd.mnt); dput_and_out: path_release(&nd); out: _ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- [RFC][PATCH 13/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 15/30] r/o bind mounts: write counts for tim... Dave Hansen
- [RFC][PATCH 14/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 16/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 17/30] r/o bind mounts: write count for file... Dave Hansen
- [RFC][PATCH 18/30] r/o bind mounts: write counts for lin... Dave Hansen
- [RFC][PATCH 20/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 19/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 21/30] r/o bind mounts: get write access for... Dave Hansen
- [RFC][PATCH 22/30] r/o bind mounts: elevate write count ... Dave Hansen
- [RFC][PATCH 23/30] r/o bind mounts: write counts for tru... Dave Hansen
- [RFC][PATCH 24/30] r/o bind mounts: elevate count for xf... Dave Hansen
- [RFC][PATCH 25/30] r/o bind mounts: make access() use ne... Dave Hansen
- [RFC][PATCH 26/30] r/o bind mounts: check mnt instead of... Dave Hansen
- [RFC][PATCH 27/30] r/o bind mounts: get callers of vfs_m... Dave Hansen
- [RFC][PATCH 28/30] r/o bind mounts: track numbers of wri... Dave Hansen
- [RFC][PATCH 29/30] r/o bind mounts: honor mount writer c... Dave Hansen
- [RFC][PATCH 30/30] r/o bind mounts: debugging for missed... Dave Hansen
- Re: [RFC][PATCH 00/30] Read-only bind mounts (-mm resend... Christoph Hellwig
- Re: [RFC][PATCH 00/30] Read-only bind mounts (-mm resend... Al Viro
- Re: [RFC][PATCH 00/30] Read-only bind mounts (-mm resend... Christoph Hellwig