linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: "J. Bruce Fields" <bfields@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] nfsd: break lease on unlink, link, and rename
Date: Fri, 14 Jan 2011 16:21:53 +0800	[thread overview]
Message-ID: <4D3007A1.6030405@cn.fujitsu.com> (raw)
In-Reply-To: <1294853809-10732-3-git-send-email-bfields@redhat.com>



J. Bruce Fields:
> Any change to any of the links pointing to an entry should also break
> delegations.
> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/vfs.c |   27 +++++++++++++++++++++++----
>  1 files changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 839ed88..f31321a 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -272,6 +272,13 @@ out:
>  	return err;
>  }
>  
> +static int nfsd_break_lease(struct inode *inode)
> +{
> +	if (!S_ISREG(inode->i_mode))
> +		return 0;
> +	return break_lease(inode, O_WRONLY | O_NONBLOCK);

Hi Bruce,

break_lease will return -EWOULDBLOCK here if break success, not 0.
  at __break_lease:
   
    1193  */
    1194 int __break_lease(struct inode *inode, unsigned int mode)
    1195 {
         ... ...  
    1253         if (i_have_this_lease || (mode & O_NONBLOCK)) {
    1254                 error = -EWOULDBLOCK;
    1255                 goto out;
    1256         }
          ... ... 
    1283 out:
    1284         unlock_flocks();
    1285         if (!IS_ERR(new_fl))
    1286                 locks_free_lock(new_fl);
    1287         return error;
    1288 }

If we just return the error -EWOULDBLOCK (which mapped to -EAGAIN) at
nfsd_break_lease(), the NFS request will be drop for -EAGAIN is mapped
to nfserr_dropit at nfserrno(). As that, client will hang up about 60s
until a retry success.

Maybe we should have a check here as:

-       return break_lease(inode, O_WRONLY | O_NONBLOCK);
+       int status = break_lease(inode, O_WRONLY | O_NONBLOCK);
+       return -EWOULDBLOCK == status ? 0 : status;

-- 
----
thanks
Mi Jinlong



  reply	other threads:[~2011-01-14  8:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 17:36 break leases on nfsd rename, setattr, etc J. Bruce Fields
2011-01-12 17:36 ` [PATCH 1/2] nfsd4: break lease on nfsd setattr J. Bruce Fields
2011-01-12 17:36 ` [PATCH 2/2] nfsd: break lease on unlink, link, and rename J. Bruce Fields
2011-01-14  8:21   ` Mi Jinlong [this message]
2011-01-14 19:33     ` J. Bruce Fields
2011-01-17  2:09       ` Mi Jinlong
2011-01-17 15:20         ` J. Bruce Fields

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=4D3007A1.6030405@cn.fujitsu.com \
    --to=mijinlong@cn.fujitsu.com \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).