[pnfs] [PATCH] add back fsid for export op cb_layout_recall

Benny Halevy bhalevy at panasas.com
Mon Jun 4 15:20:10 EDT 2007


How about the following:

(I also took out the field you added back to struct nfs4_layoutrecall
since it's not in use in your patch and changed clr->clr_file->fi_fsid
to clr->cb.cbl_fsid also in recall_return_perfect_match)

Benny

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 5a726ce..b7bc5c3 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -323,7 +323,7 @@ encode_cb_layout(struct xdr_stream *xdr, struct nfs4_layoutrecall *clr)
 	WRITE32(clr->cb.cbl_layoutchanged);
 	WRITE32(clr->cb.cbl_recall_type);
 	if (unlikely(clr->cb.cbl_recall_type == RECALL_FSID)) {
-		struct nfs4_fsid fsid = clr->clr_file->fi_fsid;
+		struct nfs4_fsid fsid = clr->cb.cbl_fsid;
 		WRITE64(fsid.major);
 		WRITE64(fsid.minor);
 		dprintk("%s: type %d iomode %d changed %d recall_type %d fsid 0x%llx-0x%llx\n",
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ee4125b..afbb792 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4333,7 +4333,7 @@ recall_return_perfect_match(struct nfs4_layoutrecall *clr,
 		clr->cb.cbl_seg.length == lrp->lr_seg.length) ||
 
 		(clr->cb.cbl_recall_type == RECALL_FSID &&
-		 same_fsid(&clr->clr_file->fi_fsid, current_fh)) ||
+		 same_fsid(&clr->cb.cbl_fsid, current_fh)) ||
 
 		clr->cb.cbl_recall_type == RECALL_ALL;
 }
@@ -4357,7 +4357,7 @@ recall_return_partial_match(struct nfs4_layoutrecall *clr,
 	/* fsid matches? */
 	if (clr->cb.cbl_recall_type == RECALL_FSID ||
 	    lrp->lr_return_type == RETURN_FSID)
-		return same_fsid(&clr->clr_file->fi_fsid, current_fh);
+		return same_fsid(&clr->cb.cbl_fsid, current_fh);
 
 	/* file matches, range overlapping? */
 	return clr->clr_file == fp &&
@@ -4500,7 +4500,7 @@ cl_has_fsid_layout(struct nfs4_client *clp, struct nfs4_layoutrecall *clr)
 
 	/* note: minor version unused */
 	list_for_each_entry(lp, &clp->cl_layouts, lo_perclnt)
-		if (lp->lo_file->fi_fsid.major == clr->clr_file->fi_fsid.major)
+		if (lp->lo_file->fi_fsid.major == clr->cb.cbl_fsid.major)
 			return 1;
 
 	return 0;
@@ -4619,7 +4619,7 @@ int nfsd_layout_recall_cb(struct inode *inode, struct nfsd4_pnfs_cb_layout *cbl)
 	BUG_ON(cbl->cbl_recall_type != RECALL_FILE &&
 	       cbl->cbl_recall_type != RECALL_FSID &&
 	       cbl->cbl_recall_type != RECALL_ALL);
-	BUG_ON(cbl->cbl_recall_type != RECALL_ALL && !inode);
+	BUG_ON(cbl->cbl_recall_type == RECALL_FILE && !inode);
 
 	clr = alloc_init_layoutrecall(NULL);
 	if (!clr)
@@ -4647,6 +4647,8 @@ int nfsd_layout_recall_cb(struct inode *inode, struct nfsd4_pnfs_cb_layout *cbl)
 			dprintk("NFSD nfsd_layout_recall_cb: nfs4_file not found\n");
 			goto err;
 		}
+		if (cbl->cbl_recall_type == RECALL_FSID)
+			clr->cb.cbl_fsid = clr->clr_file->fi_fsid;
 	}
 	nfs4_unlock_state();
 
diff --git a/include/linux/nfsd/nfsd4_pnfs.h b/include/linux/nfsd/nfsd4_pnfs.h
index e133c9c..13033bd 100644
--- a/include/linux/nfsd/nfsd4_pnfs.h
+++ b/include/linux/nfsd/nfsd4_pnfs.h
@@ -117,6 +117,7 @@ struct nfsd4_pnfs_cb_layout {
 	u32                     cbl_recall_type;	/* request */
 	struct nfsd4_layout_seg cbl_seg;		/* request */
 	u32                     cbl_layoutchanged;	/* request */
+	struct nfs4_fsid	cbl_fsid;
 };
 
 #endif /* _LINUX_NFSD_NFSD4_PNFS_H */

Marc Eshel wrote:
> Benny Halevy <bhalevy at panasas.com> wrote on 06/04/2007 10:51:47 AM:
> 
>> Marc, I understand you need a way to recall by fsid with passing
>> an inode to nfsd_layout_recall_cb.  Can we please retain the two methods
>> so that if an inode is passed in for RECALL_FSID we get the fsid from 
> it?
> 
> Sure I you going to fix it ?
> Marc.
> 
>> Benny
>>
>> Marc Eshel wrote:
>>> From: Marc Eshel <eshel at almaden.ibm.com>
>>>
>>>
>>> ---
>>>
>>>  fs/nfsd/nfs4callback.c          |    2 +-
>>>  fs/nfsd/nfs4state.c             |    6 +++---
>>>  include/linux/nfsd/nfsd4_pnfs.h |    1 +
>>>  include/linux/nfsd/state.h      |    1 +
>>>  4 files changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
>>> index 2e8e46e..7834be6 100644
>>> --- a/fs/nfsd/nfs4callback.c
>>> +++ b/fs/nfsd/nfs4callback.c
>>> @@ -322,7 +322,7 @@ encode_cb_layout(struct xdr_stream *xdr,
>>>     WRITE32(clr->cb.cbl_layoutchanged);
>>>     WRITE32(clr->cb.cbl_recall_type);
>>>     if (unlikely(clr->cb.cbl_recall_type == RECALL_FSID)) {
>>> -      struct nfs4_fsid fsid = clr->clr_file->fi_fsid;
>>> +      struct nfs4_fsid fsid = clr->cb.cbl_fsid;
>>>        WRITE64(fsid.major);
>>>        WRITE64(fsid.minor);
>>>        dprintk("%s: type %d iomode %d changed %d recall_type %d 
>> fsid 0x%llx-0x%llx\n",
>>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>>> index c354a58..53212f1 100644
>>> --- a/fs/nfsd/nfs4state.c
>>> +++ b/fs/nfsd/nfs4state.c
>>> @@ -4358,7 +4358,7 @@ recall_return_partial_match(struct nfs4_
>>>     /* fsid matches? */
>>>     if (clr->cb.cbl_recall_type == RECALL_FSID ||
>>>         lrp->lr_return_type == RETURN_FSID)
>>> -      return same_fsid(&clr->clr_file->fi_fsid, current_fh);
>>> +      return same_fsid(&clr->cb.cbl_fsid, current_fh);
>>>
>>>     /* file matches, range overlapping? */
>>>     return clr->clr_file == fp &&
>>> @@ -4501,7 +4501,7 @@ cl_has_fsid_layout(struct nfs4_client *c
>>>
>>>     /* note: minor version unused */
>>>     list_for_each_entry(lp, &clp->cl_layouts, lo_perclnt)
>>> -      if (lp->lo_file->fi_fsid.major == clr->clr_file->fi_fsid.major)
>>> +      if (lp->lo_file->fi_fsid.major == clr->cb.cbl_fsid.major)
>>>           return 1;
>>>
>>>     return 0;
>>> @@ -4620,7 +4620,7 @@ int nfsd_layout_recall_cb(struct inode *
>>>     BUG_ON(cbl->cbl_recall_type != RECALL_FILE &&
>>>            cbl->cbl_recall_type != RECALL_FSID &&
>>>            cbl->cbl_recall_type != RECALL_ALL);
>>> -   BUG_ON(cbl->cbl_recall_type != RECALL_ALL && !inode);
>>> +   BUG_ON(cbl->cbl_recall_type == RECALL_FILE && !inode);
>>>
>>>     clr = alloc_init_layoutrecall(NULL);
>>>     if (!clr)
>>> diff --git a/include/linux/nfsd/nfsd4_pnfs.h 
>> b/include/linux/nfsd/nfsd4_pnfs.h
>>> index fe2f375..e051916 100644
>>> --- a/include/linux/nfsd/nfsd4_pnfs.h
>>> +++ b/include/linux/nfsd/nfsd4_pnfs.h
>>> @@ -118,6 +118,7 @@ struct nfsd4_pnfs_cb_layout {
>>>     u32                     cbl_recall_type;   /* request */
>>>     struct nfsd4_layout_seg cbl_seg;      /* request */
>>>     u32                     cbl_layoutchanged;   /* request */
>>> +   struct nfs4_fsid   cbl_fsid;
>>>  };
>>>
>>>  #endif /* _LINUX_NFSD_NFSD4_PNFS_H */
>>> diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
>>> index 7ed3863..953c1d2 100644
>>> --- a/include/linux/nfsd/state.h
>>> +++ b/include/linux/nfsd/state.h
>>> @@ -269,6 +269,7 @@ struct nfs4_layoutrecall {
>>>     struct nfs4_file               *clr_file;
>>>     int                             clr_status;
>>>     struct timespec                 clr_time;       /* last activity 
> */
>>> +   struct nfs4_fsid      cbr_fsid;
>>>  };
>>>
>>>  #endif /* CONFIG_PNFS */
>>> _______________________________________________
>>> pNFS mailing list
>>> pNFS at linux-nfs.org
>>> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
> 



More information about the pNFS mailing list