From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [RFC][PATCH 11/20] elevate write count over calls to vfs_rename() Date: Mon, 19 Jun 2006 10:18:48 -0700 Message-ID: <1150737528.10515.62.camel@localhost.localdomain> References: <20060616231213.D4C5D6AF@localhost.localdomain> <20060616231221.C30C0D59@localhost.localdomain> <20060618182359.GY27946@ftp.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, herbert@13thfloor.at, Trond Myklebust Return-path: Received: from e1.ny.us.ibm.com ([32.97.182.141]:15849 "EHLO e1.ny.us.ibm.com") by vger.kernel.org with ESMTP id S964812AbWFSRSy (ORCPT ); Mon, 19 Jun 2006 13:18:54 -0400 To: Al Viro In-Reply-To: <20060618182359.GY27946@ftp.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sun, 2006-06-18 at 19:23 +0100, Al Viro wrote: > a) nfsd_rename() should check that tfhp->fh_export->ex_mnt == > ffhp->fh_export->ex_mnt (if not that tfhp->fh_export == ffhp->fh_export) > instead of comparing ->i_sb > b) that patch should do mnt_want_write() only once. Here's a replacement. diff -puN fs/nfsd/vfs.c~C-elevate-writers-vfs_rename-part1 fs/nfsd/vfs.c --- lxc/fs/nfsd/vfs.c~C-elevate-writers-vfs_rename-part1 2006-06-19 08:43:10.000000000 -0700 +++ lxc-dave/fs/nfsd/vfs.c 2006-06-19 10:09:19.000000000 -0700 @@ -1597,13 +1597,21 @@ nfsd_rename(struct svc_rqst *rqstp, stru err = -EPERM; } else #endif + err = -EXDEV + if (ffhp->fh_export->ex_mnt != tfhp->fh_export->ex_mnt) + goto out_dput_new; + + err = mnt_want_write(ffhp->fh_export->ex_mnt); + if (err) + goto out_dput_new; + err = vfs_rename(fdir, odentry, tdir, ndentry); if (!err && EX_ISSYNC(tfhp->fh_export)) { err = nfsd_sync_dir(tdentry); if (!err) err = nfsd_sync_dir(fdentry); } - + mnt_drop_write(ffhp->fh_export->ex_mnt); out_dput_new: dput(ndentry); out_dput_old: -- Dave