From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: + r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate.patch added to -mm tree Date: Wed, 14 Feb 2007 21:02:50 -0800 Message-ID: <200702150502.l1F52oIe020372@shell0.pdx.osdl.net> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from smtp.osdl.org ([65.172.181.24]:34989 "EHLO smtp.osdl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbXBOFKE (ORCPT ); Thu, 15 Feb 2007 00:10:04 -0500 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org Cc: hansendc@us.ibm.com, haveblue@us.ibm.com, hch@lst.de, miklos@szeredi.hu, viro@zeniv.linux.org.uk The patch titled r/o bind mounts: elevate writer count for do_sys_truncate() has been added to the -mm tree. Its filename is r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: r/o bind mounts: elevate writer count for do_sys_truncate() From: Dave Hansen Signed-off-by: Dave Hansen Cc: Al Viro Cc: Christoph Hellwig Cc: Miklos Szeredi Signed-off-by: Andrew Morton --- fs/open.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff -puN fs/open.c~r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate fs/open.c --- a/fs/open.c~r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate +++ a/fs/open.c @@ -241,28 +241,28 @@ 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; /* * 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 +271,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: _ Patches currently in -mm which might be from hansendc@us.ibm.com are r-o-bind-mounts-document-nlink-function.patch r-o-bind-mounts-filesystem-helpers-for-custom-struct-files.patch r-o-bind-mounts-r-o-bind-mounts-stub-functions.patch r-o-bind-mounts-ext3-remove-extra-is_rdonly-check.patch r-o-bind-mounts-ext4-remove-extra-is_rdonly-check.patch r-o-bind-mounts-r-o-bind-mounts-elevate-write-count-for-some-ioctls.patch r-o-bind-mounts-elevate-writer-count-for-chown-and-friends.patch r-o-bind-mounts-make-access-use-mnt-check.patch r-o-bind-mounts-elevate-mnt-writers-for-callers-of-vfs_mkdir.patch r-o-bind-mounts-elevate-write-count-during-entire-ncp_ioctl.patch r-o-bind-mounts-elevate-write-count-for-link-and-symlink-calls.patch r-o-bind-mounts-elevate-mount-count-for-extended-attributes.patch r-o-bind-mounts-elevate-write-count-for-file_update_time.patch r-o-bind-mounts-mount_is_safe-add-comment.patch r-o-bind-mounts-unix_find_other-elevate-write-count-for-touch_atime.patch r-o-bind-mounts-elevate-write-count-over-calls-to-vfs_rename.patch r-o-bind-mounts-elevate-write-count-files-are-opened.patch r-o-bind-mounts-nfs-check-mnt-instead-of-sb.patch r-o-bind-mounts-elevate-writer-count-for-do_sys_truncate.patch r-o-bind-mounts-elevate-write-count-for-do_utimes.patch r-o-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atime.patch r-o-bind-mounts-sys_mknodat-elevate-write-count-for-vfs_mknod-create.patch r-o-bind-mounts-elevate-mnt-writers-for-vfs_unlink-callers.patch r-o-bind-mounts-do_rmdir-elevate-write-count.patch r-o-bind-mounts-elevate-writer-count-for-custom-struct_file.patch r-o-bind-mounts-remove-is_rdonly-from-permission.patch r-o-bind-mounts-reiser4-remove-is_rdonly-checks.patch