aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsfh.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-09-05 17:22:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-10 21:57:47 -0400
commitb8da0d1c27f144bce999c653467106f3f0d5a308 (patch)
treeeedc2f54d8dd6768b953b4d9e1b6075b62fc21ad /fs/nfsd/nfsfh.c
parenta1033be72cdb053e182bb41e302a1c11e72b68bb (diff)
knfsd: Validate filehandle type in fsid_source
fsid_source decided where to get the 'fsid' number to return for a GETATTR based on the type of filehandle. It can be from the device, from the fsid, or from the UUID. It is possible for the filehandle to be inconsistent with the export information, so make sure the export information actually has the info implied by the value returned by fsid_source. Signed-off-by: Neil Brown <neilb@suse.de> Cc: "Luiz Fernando N. Capitulino" <lcapitulino@gmail.com> Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfsd/nfsfh.c')
-rw-r--r--fs/nfsd/nfsfh.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 0eb464a39aae..7011d62acfc8 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -566,13 +566,23 @@ enum fsid_source fsid_source(struct svc_fh *fhp)
566 case FSID_DEV: 566 case FSID_DEV:
567 case FSID_ENCODE_DEV: 567 case FSID_ENCODE_DEV:
568 case FSID_MAJOR_MINOR: 568 case FSID_MAJOR_MINOR:
569 return FSIDSOURCE_DEV; 569 if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags
570 & FS_REQUIRES_DEV)
571 return FSIDSOURCE_DEV;
572 break;
570 case FSID_NUM: 573 case FSID_NUM:
571 return FSIDSOURCE_FSID;
572 default:
573 if (fhp->fh_export->ex_flags & NFSEXP_FSID) 574 if (fhp->fh_export->ex_flags & NFSEXP_FSID)
574 return FSIDSOURCE_FSID; 575 return FSIDSOURCE_FSID;
575 else 576 break;
576 return FSIDSOURCE_UUID; 577 default:
578 break;
577 } 579 }
580 /* either a UUID type filehandle, or the filehandle doesn't
581 * match the export.
582 */
583 if (fhp->fh_export->ex_flags & NFSEXP_FSID)
584 return FSIDSOURCE_FSID;
585 if (fhp->fh_export->ex_uuid)
586 return FSIDSOURCE_UUID;
587 return FSIDSOURCE_DEV;
578} 588}