linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: NFSv3 list <linux-nfs@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org, ebiederm@xmission.com,
	adobriyan@gmail.com, viro@ZenIV.linux.org.uk,
	jamie@shareable.org,
	"Trond.Myklebust" <trond.myklebust@fys.uio.no>,
	"J. Bruce Fields" <bfields@fieldses.org>
Subject: Re: [PATCH] VFS: Unlink should revoke all outstanding leases on file
Date: Wed, 19 May 2010 17:49:38 +0800	[thread overview]
Message-ID: <4BF3B432.3040802@cn.fujitsu.com> (raw)
In-Reply-To: <20100514055844.109d2fdc-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>



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.

--------------------------------------------------------------

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@cn.fujitsu.com>

---
 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





  parent reply	other threads:[~2010-05-19  9:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14  9:35 [PATCH] VFS: Unlink should revoke all outstanding leases on file Mi Jinlong
2010-05-14  9:58 ` Jeff Layton
2010-05-14 17:17   ` Trond Myklebust
2010-05-14 17:38     ` Jeff Layton
2010-05-14 17:46       ` Jamie Lokier
2010-05-14 18:16         ` Jeremy Allison
2010-05-19 14:06           ` J. Bruce Fields
2010-05-19 16:21             ` Jamie Lokier
2010-05-14 17:59       ` Trond Myklebust
2010-05-14 18:31         ` Trond Myklebust
2010-05-14 19:23           ` J. Bruce Fields
2010-05-19  9:46             ` Mi Jinlong
2010-05-19 15:57               ` J. Bruce Fields
2010-05-20  9:46                 ` Mi Jinlong
2010-05-21 21:07                   ` J. Bruce Fields
2010-05-25 10:14                     ` Mi Jinlong
2010-05-19 16:14             ` Jamie Lokier
2010-05-20  2:21               ` J. Bruce Fields
     [not found]   ` <20100514055844.109d2fdc-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-05-19  9:49     ` Mi Jinlong [this message]
2010-05-19 16:03       ` J. Bruce Fields
2010-05-20  9:23         ` Mi Jinlong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF3B432.3040802@cn.fujitsu.com \
    --to=mijinlong@cn.fujitsu.com \
    --cc=adobriyan@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=ebiederm@xmission.com \
    --cc=jamie@shareable.org \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).