Re: [pnfs] [PATCH 4/5] pnfsd: fix DLM file layout no device return

Boaz Harrosh
2010-02-07T09:33:39Z

On 02/05/2010 07:10 PM, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
>
> Signed-off-by: Andy Adamson <andros@netapp.com>
> ---
> fs/nfsd/nfs4pnfsdlm.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
> index 8cc7c84..83c4698 100644
> --- a/fs/nfsd/nfs4pnfsdlm.c
> +++ b/fs/nfsd/nfs4pnfsdlm.c
> @@ -316,7 +316,7 @@ static int dlm_ino_hash(struct inode *ino)
> */
> de = nfsd4_find_pnfs_dlm_device(ino->i_sb->s_bdev->bd_disk->disk_name);
> if (!de)
> - return -EINVAL;
> + return -1;
> hash_mask = de->num_ds - 1;
> return ino->i_ino & hash_mask;
> }
> @@ -340,7 +340,7 @@ static int nfsd4_pnfs_dlm_layoutget(struct inode *inode,
> dprintk("%s first stripe index %d i_ino %lu\n", __func__, index,
> inode->i_ino);
> if (index < 0)
> - return index;
> + return nfserr_layoutunavailable;

You are relaying on a side effect that undefined errors
are nfserr_layoutunavailable. That's not so noble ;)

I wish we would only allow nfserr_* and your first patch
defines the allowed returns from layoutget

(I can fix exofs, easily, if we just agree on protocol)

Thanks
Boaz
>
> res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
> /* Always give out whole file layouts */