Re: [nfsv4] [pnfs] [PATCH 1/1] pnfsd: DLM file layout only support read iomode layouts

"William A. (Andy) Adamson" <androsadamson@gmail.com> Wed, 16 December 2009 15:27 UTC

Return-Path: <androsadamson@gmail.com>
X-Original-To: nfsv4@core3.amsl.com
Delivered-To: nfsv4@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 85D0F3A6991 for <nfsv4@core3.amsl.com>; Wed, 16 Dec 2009 07:27:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s0ArsB8OXRmf for <nfsv4@core3.amsl.com>; Wed, 16 Dec 2009 07:27:16 -0800 (PST)
Received: from mail-yw0-f185.google.com (mail-yw0-f185.google.com [209.85.211.185]) by core3.amsl.com (Postfix) with ESMTP id DF2403A67E6 for <nfsv4@ietf.org>; Wed, 16 Dec 2009 07:27:15 -0800 (PST)
Received: by ywh15 with SMTP id 15so1099756ywh.5 for <nfsv4@ietf.org>; Wed, 16 Dec 2009 07:26:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rC6V8y3KVCflIGSuV1kDgriEikiy+Sp1BdwfRjpCIxY=; b=du1VjKU4+VPQWy5o7hCZiLFQbkt1GWXk7RwtS4XlG6+WZuP34ioi1KXzVd4iUKCK8t TfaWuuSptoeRAq4t+N1rQW9JI7Xf9WbVeMbRLAa8FIPMdMyFORCu5Sv8032sNy/uID+j CF7XBBghX3ivngnRz3lSslyeJT3Mf2g5fuzao=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=sSZCihOBobCjDKl4CBUQgA2GssgiG/mueFKMcwctPfJ35nwTCGv3wOp39V3Qp1MOeJ jYQLAk0FrlOHJ0lrnTx/nrFmL7R9pSHsfygbVh5RGJi066AFis3CkqTDnkW8/zjgkkpI pp8mpQIGTUUM6lODV8FSLgwkh1QZN6EuuMd18=
MIME-Version: 1.0
Received: by 10.150.237.4 with SMTP id k4mr1912755ybh.93.1260977217124; Wed, 16 Dec 2009 07:26:57 -0800 (PST)
In-Reply-To: <4B28D006.4000409@panasas.com>
References: <1260907434-7484-1-git-send-email-andros@netapp.com> <1260907434-7484-2-git-send-email-andros@netapp.com> <20091215224155.GF8686@fieldses.org> <4B28D006.4000409@panasas.com>
Date: Wed, 16 Dec 2009 10:26:57 -0500
Message-ID: <89c397150912160726l65469d9nb3df68d06fdc190d@mail.gmail.com>
From: "William A. (Andy) Adamson" <androsadamson@gmail.com>
To: Benny Halevy <bhalevy@panasas.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: "J. Bruce Fields" <bfields@fieldses.org>, pnfs@linux-nfs.org, NFSv4 <nfsv4@ietf.org>
Subject: Re: [nfsv4] [pnfs] [PATCH 1/1] pnfsd: DLM file layout only support read iomode layouts
X-BeenThere: nfsv4@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: NFSv4 Working Group <nfsv4.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/nfsv4>
List-Post: <mailto:nfsv4@ietf.org>
List-Help: <mailto:nfsv4-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Dec 2009 15:27:18 -0000

On Wed, Dec 16, 2009 at 7:18 AM, Benny Halevy <bhalevy@panasas.com> wrote:
> Bruce, I agree that the spec isn't clear about what to return
> so I'm adding the ietf list to this thread.
>
> In summary, we have a server that supports read-only layouts but
> not read-write.  What should it return to a LAYOUTGET with LAYOUTIOMODE4_RW?
>
> We see two possibilities that make sense: NFS4ERR_BADIOMODE and
> NFS4ERR_LAYOUTUNAVAILABLE.
>
> 15.1.10.1.  NFS4ERR_BADIOMODE (Error Code 10049)
>
>   An invalid or inappropriate layout iomode was specified.

The spec is fine. Inappropriate means the server does not want to
return a layout for that file with the requested iomode at this time.
It doesn't necessarily mean that the server won't return a layout with
that same iomode for a different file, or return a layout for the file
with the requested iomode at a later date.  It's totally up to the
server what is appropriate.
For what ever reason, the client has no choice but to try a different
iomode and/or
shoulder on via the MDS,

>
> 15.1.10.4.  NFS4ERR_LAYOUTUNAVAILABLE (Error Code 10059)
>
>   Returned when layouts are not available for the current file system
>   or the particular specified file.
>
> NFS4ERR_BADIOMODE seems to make more sense since layouts are available,
> just not for the requested iomode. However its definition indicates that
> the iomode in the client request is "invalid or inappropriate".
> It is not clear what "inappropriate" means in this context.

What difference does 'what inappropriate means' make to the client?
None! It's up to the server.

> I guess that the original intent was for clients who e.g. send a LAYOUTGET
> with LAYOUTIOMODE4_ANY which is a valid iomode but inappropriate for LAYOUTGET.

The client specifies the iomode so that the server can decide whether
it is appropriate to return a layout or not. This is why
LAYOUTIOMODE4_ANY is not allowed on LAYOUTGET.

>
> To make the spec clearer we could say:
>
> 15.1.10.1.  NFS4ERR_BADIOMODE (Error Code 10049)
>
>   An invalid, inappropriate, or unsupported layout iomode was specified.

This is redundant. One meaning of inappropriate is unsupported.
Another reason is 'sorry, I'm re-striping, and this file has read-only
layouts now'. Another reason is ' it's Tuesday, and I don't hand out
layouts with iomode blah for file bleep on Tuesday. It's the server's
choice so the client just has to get over it and move on!

-->Andy


>
> 18.43.  Operation 50: LAYOUTGET - Get Layout Information
> 18.43.3.  DESCRIPTION
> iomode
> ...
> +     If the metadata server does not support read/write layouts and
> +     the value of the lo_iomode is LAYOUTIOMODE4_RW it MUST return
> +     NFS4ERR_BADIOMODE.
>
>
> Benny
>
> On Dec. 16, 2009, 0:41 +0200, "J. Bruce Fields" <bfields@fieldses.org> wrote:
>> On Tue, Dec 15, 2009 at 03:03:54PM -0500, andros@netapp.com wrote:
>>> From: Andy Adamson <andros@netapp.com>
>>>
>>> In a DLM cluster, writing to a node other than the node where the open call
>>> occurred will have performance implications due to meta data updates.
>>>
>>> Return only LAYOUTIOMODE4_READ layouts so that writes go through the MDS
>>> LAYOUTGET with LAYOUTIOMODE4_RW iomodes will receive the NFS4ERR_BADIOMODE
>>> error.
>>
>> Hm.  The 4.1 draft does refer (in 13.8) to using LAYOUTIOMODE4_READ
>> layouts for the read-only data-server case, but doesn't really give a
>> clear error recommendation for it.  BADIOMODE says "An invalid or
>> inappropriate layout iomode was specified".  The client definitely isn't
>> making an *invalid* request.  I don't know what inappropriate means.
>>
>> LAYOUTUNAVAILABLE might be better, though it doesn't mention this
>> particular case: "Returned when layouts are not available for the
>> current file system or the particular specified file."  So a client
>> might reasonably take that to mean that it shouldn't ever ask for that
>> file again.
>>
>> I guess BADIOMODE wins, but the spec could be clearer.
>>
>> --b.
>>
>>> Pass the NFS4ERR_BADIOMODE error to the client - Don't map
>>> pnfs_export_operation:layout_get() NFS4 errors.
>>>
>>> Signed-off-by: Andy Adamson <andros@netapp.com>
>>> ---
>>>  fs/nfsd/nfs4pnfsd.c   |    2 +-
>>>  fs/nfsd/nfs4pnfsdlm.c |    4 ++++
>>>  2 files changed, 5 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
>>> index aa7abad..658a343 100644
>>> --- a/fs/nfsd/nfs4pnfsd.c
>>> +++ b/fs/nfsd/nfs4pnfsd.c
>>> @@ -541,7 +541,7 @@ nfs4_pnfs_get_layout(struct nfsd4_pnfs_layoutget *lgp,
>>>              __func__, status, res.lg_seg.iomode,
>>>              res.lg_seg.offset, res.lg_seg.length);
>>>
>>> -    if (status) {
>>> +    if (status && status >= -1000) {
>>>              switch (status) {
>>>              case -ETOOSMALL:
>>>                      status = nfserr_toosmall;
>>> diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
>>> index ed2e940..94ddba2 100644
>>> --- a/fs/nfsd/nfs4pnfsdlm.c
>>> +++ b/fs/nfsd/nfs4pnfsdlm.c
>>> @@ -329,6 +329,10 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
>>>
>>>      dprintk("%s: LAYOUT_GET\n", __func__);
>>>
>>> +    /* Due to DLM internode locking, only support read layouts */
>>> +    if res->lg_seg.iomode != IOMODE_READ)
>>> +            return nfserr_badiomode;
>>> +
>>>      index = dlm_ino_hash(inode);
>>>      dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
>>>              inode->i_ino);
>>> --
>>> 1.6.2.5
>>>
> _______________________________________________
> pNFS mailing list
> pNFS@linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>