From patchwork Tue Mar 1 15:07:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 601801 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p224pMY2031674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 2 Mar 2011 04:51:43 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.74) (envelope-from ) id 1Pue1f-0005xV-A5; Wed, 02 Mar 2011 04:51:03 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.74) (envelope-from ) id 1PuRB2-00065m-P7 for v9fs-developer@lists.sourceforge.net; Tue, 01 Mar 2011 15:07:52 +0000 X-ACL-Warn: Received: from e28smtp06.in.ibm.com ([122.248.162.6]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.74) id 1PuRAz-00087j-FJ for v9fs-developer@lists.sourceforge.net; Tue, 01 Mar 2011 15:07:52 +0000 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp06.in.ibm.com (8.14.4/8.13.1) with ESMTP id p21F7fqj009895 for ; Tue, 1 Mar 2011 20:37:41 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p21F7fEX4481166 for ; Tue, 1 Mar 2011 20:37:41 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p21F7ecK022896 for ; Wed, 2 Mar 2011 02:07:40 +1100 Received: from skywalker.linux.vnet.ibm.com ([9.124.94.54]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p21F7QOs022251; Wed, 2 Mar 2011 02:07:31 +1100 From: "Aneesh Kumar K. V" To: Christoph Hellwig In-Reply-To: <20110301121012.GA15516@infradead.org> References: <1298969484-16199-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1298969484-16199-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <20110301121012.GA15516@infradead.org> User-Agent: Notmuch/0.5-66-g70c5e2c (http://notmuchmail.org) Emacs/23.1.1 (i686-pc-linux-gnu) Date: Tue, 01 Mar 2011 20:37:23 +0530 Message-ID: <87hbbmev6c.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 X-Spam-Score: 0.5 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.5 AWL AWL: From: address is in the auto white-list X-Headers-End: 1PuRAz-00087j-FJ Cc: linux-fsdevel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [V9fs-developer] [PATCH 2/6] fs/9p: call vmtruncate before setattr 9p opeation X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 02 Mar 2011 04:51:48 +0000 (UTC) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index c6cef24..561c355 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -970,6 +970,10 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) struct p9_fid *fid; struct p9_wstat wstat; + retval = inode_change_ok(dentry->d_inode, iattr); + if (retval) + return retval; + P9_DPRINTK(P9_DEBUG_VFS, "\n"); retval = -EPERM; v9ses = v9fs_inode2v9ses(dentry->d_inode); @@ -998,11 +1002,9 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) wstat.n_gid = iattr->ia_gid; } if ((iattr->ia_valid & ATTR_SIZE) && - iattr->ia_size != i_size_read(dentry->d_inode)) { - retval = vmtruncate(dentry->d_inode, iattr->ia_size); - if (retval) - return retval; - } + iattr->ia_size != i_size_read(dentry->d_inode)) + truncate_setsize(dentry->d_inode, iattr->ia_size); + /* Write all dirty data */ if (S_ISREG(dentry->d_inode->i_mode)) filemap_write_and_wait(dentry->d_inode->i_mapping); diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 327c578..2e2d377 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -457,11 +457,9 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) return PTR_ERR(fid); if ((iattr->ia_valid & ATTR_SIZE) && - iattr->ia_size != i_size_read(dentry->d_inode)) { - retval = vmtruncate(dentry->d_inode, iattr->ia_size); - if (retval) - return retval; - } + iattr->ia_size != i_size_read(dentry->d_inode)) + truncate_setsize(dentry->d_inode, iattr->ia_size); + /* Write all dirty data */ if (S_ISREG(dentry->d_inode->i_mode)) filemap_write_and_wait(dentry->d_inode->i_mapping);