Re: [patch 4/5] tmpfs: convert to use the new truncate convention

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 16, 2009 at 07:38:51PM +0100, Hugh Dickins wrote:
> On Sun, 16 Aug 2009, npiggin@xxxxxxx wrote:
> >  mm/shmem.c |   35 +++++++++++++++++++----------------
> >  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> That looks fine to me, thanks Nick, with one reservation:
> there is no case (at present anyway) in which simple_setsize()
> can fail with non-NULL page to release; but that does depend upon
> some inside knowledge, so it'll look less worrying if we move up
> the page_cache_release.  Please fold the below patch in to add my

Ah good point, that looks much better. Thanks Hugh.

> 
> Acked-by: Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx>
> 
> --- 2.6.31-rc6-trunc/mm/shmem.c	2009-08-16 17:09:57.000000000 +0100
> +++ linux/mm/shmem.c	2009-08-16 19:11:51.000000000 +0100
> @@ -767,13 +767,13 @@ done2:
>  static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
>  {
>  	struct inode *inode = dentry->d_inode;
> -	struct page *page = NULL;
>  	int error;
>  
>  	if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
>  		loff_t newsize = attr->ia_size;
> +		struct page *page = NULL;
>  
> -		if (attr->ia_size < inode->i_size) {
> +		if (newsize < inode->i_size) {
>  			/*
>  			 * If truncating down to a partial page, then
>  			 * if that page is already allocated, hold it
> @@ -804,6 +804,8 @@ static int shmem_notify_change(struct de
>  		}
>  
>  		error = simple_setsize(inode, newsize);
> +		if (page)
> +			page_cache_release(page);
>  		if (error)
>  			return error;
>  		shmem_truncate_range(inode, newsize, (loff_t)-1);
> @@ -817,8 +819,6 @@ static int shmem_notify_change(struct de
>  	if (!error && (attr->ia_valid & ATTR_MODE))
>  		error = generic_acl_chmod(inode, &shmem_acl_ops);
>  #endif
> -	if (page)
> -		page_cache_release(page);
>  	return error;
>  }
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux