Re: [PATCH] VFS: Unlink should revoke all outstanding leases on file

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

 



On Wed, May 19, 2010 at 05:49:38PM +0800, Mi Jinlong wrote:
> 
> 
> Jeff Layton :
> >>  /*	Check whether we can create an object with dentry child in directory
> > 
> > This doesn't look right to me.
> > 
> > The fcntl(2) manpage basically says that leases should be broken if the
> > file is opened for read or write, or is truncated. unlinks don't seem
> > to fall into either category...
> 
> Maybe the new one is better than before.

On a quick glance, break_lease() (with O_NONBLOCK unset, as here) should
only return ENOMEM or ERSTARTSYS, either of which I suspect is OK.

--b.

> 
> --------------------------------------------------------------
> 
> After client get one file's READ delegation through NFSv4,
> server delete this file but don't reclaim the delegation.
> 
> This patch add break_lease at may_delete, which can reclaim delegations.
> 
> Signed-off-by: Mi Jinlong <mijinlong@xxxxxxxxxxxxxx>
> 
> ---
>  fs/namei.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index b86b96f..0423e19 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1338,6 +1338,10 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
>  		return -ENOENT;
>  	if (victim->d_flags & DCACHE_NFSFS_RENAMED)
>  		return -EBUSY;
> +
> +	/* try to break leases, but no effect to delete. */
> +	break_lease(victim->d_inode, FMODE_WRITE);
> +
>  	return 0;
>  }
>  
> -- 
> 1.7.0
> 
> 
> 
> 
--
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