Signed-off-by: Dave Hansen <[EMAIL PROTECTED]>
---
lxc-dave/fs/open.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff -puN fs/open.c~15-24-elevate-writer-count-for-do-sys-truncate fs/open.c
--- lxc/fs/open.c~15-24-elevate-writer-count-for-do-sys-truncate
2007-02-09 14:26:55.000000000 -0800
+++ lxc-dave/fs/open.c 2007-02-09 14:26:55.000000000 -0800
@@ -241,28 +241,32 @@ 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 = vfs_permission(&nd, MAY_WRITE);
+ if (error)
+ goto mnt_drop_write_and_out;
+
error = -EROFS;
if (IS_RDONLY(inode))
- goto dput_and_out;
+ 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;
/*
* Make sure that there are no leases.
*/
error = break_lease(inode, FMODE_WRITE);
if (error)
- 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;
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
@@ -271,6 +275,8 @@ static long do_sys_truncate(const char _
}
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/
- Re: [PATCH 21/22] honor r/w changes at do_remount(... Jan Engelhardt
- [PATCH 05/22] elevate mnt writers for callers of vfs_mkdir(... Dave Hansen
- [PATCH 09/22] mount_is_safe(): add comment Dave Hansen
- [PATCH 10/22] unix_find_other() elevate write count for tou... Dave Hansen
- [PATCH 11/22] elevate write count over calls to vfs_rename(... Dave Hansen
- [PATCH 18/22] do_rmdir(): elevate write count Dave Hansen
- [PATCH 20/22] [PATCH] gfs: check nlink count Dave Hansen
- [PATCH 17/22] elevate mnt writers for vfs_unlink() callers Dave Hansen
- [PATCH 14/22] elevate write count for do_utimes() Dave Hansen
- [PATCH 16/22] sys_mknodat(): elevate write count for vfs_mk... Dave Hansen
- [PATCH 13/22] elevate writer count for do_sys_truncate() Dave Hansen
- [PATCH 15/22] elevate write count for do_sys_utime() and to... Dave Hansen
- [PATCH 12/22] elevate write count files are open()ed Dave Hansen
- Re: [PATCH 12/22] elevate write count files are open()... Andrew Morton
- Re: [PATCH 12/22] elevate write count files are op... Dave Hansen
- Re: [PATCH 12/22] elevate write count files ar... Andrew Morton
- Re: [PATCH 12/22] elevate write count file... Dave Hansen
- [PATCH 19/22] elevate writer count for custom struct_file Dave Hansen
- [PATCH 22/22] kill open files traverse on remount ro Dave Hansen
- [PATCH 02/22] r/o bind mounts: add vfsmount writer counts Dave Hansen

