diff mbox

NFSD: Check layout type when returning client layouts

Message ID 550AAD2E.6040607@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee March 19, 2015, 11:04 a.m. UTC
According to RFC5661:
" When lr_returntype is LAYOUTRETURN4_FSID, the current filehandle is used
   to identify the file system and all layouts matching the client ID,
   the fsid of the file system, lora_layout_type, and lora_iomode are
   returned.  When lr_returntype is LAYOUTRETURN4_ALL, all layouts
   matching the client ID, lora_layout_type, and lora_iomode are
   returned and the current filehandle is not used. "

When returning client layouts, always check layout type.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/nfs4layouts.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig March 19, 2015, 2:39 p.m. UTC | #1
On Thu, Mar 19, 2015 at 07:04:14PM +0800, Kinglong Mee wrote:
> According to RFC5661:
> " When lr_returntype is LAYOUTRETURN4_FSID, the current filehandle is used
>    to identify the file system and all layouts matching the client ID,
>    the fsid of the file system, lora_layout_type, and lora_iomode are
>    returned.  When lr_returntype is LAYOUTRETURN4_ALL, all layouts
>    matching the client ID, lora_layout_type, and lora_iomode are
>    returned and the current filehandle is not used. "
> 
> When returning client layouts, always check layout type.
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 3c1bfa1..44341d6 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -513,6 +513,9 @@  nfsd4_return_client_layouts(struct svc_rqst *rqstp,
 
 	spin_lock(&clp->cl_lock);
 	list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) {
+		if (ls->ls_layout_type != lrp->lr_layout_type)
+			continue;
+
 		if (lrp->lr_return_type == RETURN_FSID &&
 		    !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle,
 				   &cstate->current_fh.fh_handle))