nfsfh.c (bf61c8840efe60fd8f91446860b63338fb424158) | nfsfh.c (97e47fa11deae10ae72aa1109e700565c57152f5) |
---|---|
1/* 2 * NFS server file handle treatment. 3 * 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 5 * Portions Copyright (C) 1999 G. Allen Morris III <gam3@acm.org> 6 * Extensive rewrite by Neil Brown <neilb@cse.unsw.edu.au> Southern-Spring 1999 7 * ... and again Southern-Winter 2001 to support export_operations 8 */ --- 33 unchanged lines hidden (view full) --- 42 if (err < 0) { 43 dput(parent); 44 break; 45 } 46 dput(tdentry); 47 tdentry = parent; 48 } 49 if (tdentry != exp->ex_path.dentry) | 1/* 2 * NFS server file handle treatment. 3 * 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 5 * Portions Copyright (C) 1999 G. Allen Morris III <gam3@acm.org> 6 * Extensive rewrite by Neil Brown <neilb@cse.unsw.edu.au> Southern-Spring 1999 7 * ... and again Southern-Winter 2001 to support export_operations 8 */ --- 33 unchanged lines hidden (view full) --- 42 if (err < 0) { 43 dput(parent); 44 break; 45 } 46 dput(tdentry); 47 tdentry = parent; 48 } 49 if (tdentry != exp->ex_path.dentry) |
50 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name); | 50 dprintk("nfsd_acceptable failed at %p %pd\n", tdentry, tdentry); |
51 rv = (tdentry == exp->ex_path.dentry); 52 dput(tdentry); 53 return rv; 54} 55 56/* Type check. The correct error return for type mismatches does not seem to be 57 * generally agreed upon. SunOS seems to use EISDIR if file isn't S_IFREG; a 58 * comment in the NFSv3 spec says this is incorrect (implementation notes for --- 189 unchanged lines hidden (view full) --- 248 if (IS_ERR(dentry)) { 249 if (PTR_ERR(dentry) != -EINVAL) 250 error = nfserrno(PTR_ERR(dentry)); 251 goto out; 252 } 253 254 if (S_ISDIR(dentry->d_inode->i_mode) && 255 (dentry->d_flags & DCACHE_DISCONNECTED)) { | 51 rv = (tdentry == exp->ex_path.dentry); 52 dput(tdentry); 53 return rv; 54} 55 56/* Type check. The correct error return for type mismatches does not seem to be 57 * generally agreed upon. SunOS seems to use EISDIR if file isn't S_IFREG; a 58 * comment in the NFSv3 spec says this is incorrect (implementation notes for --- 189 unchanged lines hidden (view full) --- 248 if (IS_ERR(dentry)) { 249 if (PTR_ERR(dentry) != -EINVAL) 250 error = nfserrno(PTR_ERR(dentry)); 251 goto out; 252 } 253 254 if (S_ISDIR(dentry->d_inode->i_mode) && 255 (dentry->d_flags & DCACHE_DISCONNECTED)) { |
256 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", 257 dentry->d_parent->d_name.name, dentry->d_name.name); | 256 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %pd2\n", 257 dentry); |
258 } 259 260 fhp->fh_dentry = dentry; 261 fhp->fh_export = exp; 262 return 0; 263out: 264 exp_put(exp); 265 return error; --- 90 unchanged lines hidden (view full) --- 356 if (error) 357 goto out; 358 359skip_pseudoflavor_check: 360 /* Finally, check access permissions. */ 361 error = nfsd_permission(rqstp, exp, dentry, access); 362 363 if (error) { | 258 } 259 260 fhp->fh_dentry = dentry; 261 fhp->fh_export = exp; 262 return 0; 263out: 264 exp_put(exp); 265 return error; --- 90 unchanged lines hidden (view full) --- 356 if (error) 357 goto out; 358 359skip_pseudoflavor_check: 360 /* Finally, check access permissions. */ 361 error = nfsd_permission(rqstp, exp, dentry, access); 362 363 if (error) { |
364 dprintk("fh_verify: %s/%s permission failure, " | 364 dprintk("fh_verify: %pd2 permission failure, " |
365 "acc=%x, error=%d\n", | 365 "acc=%x, error=%d\n", |
366 dentry->d_parent->d_name.name, 367 dentry->d_name.name, | 366 dentry, |
368 access, ntohl(error)); 369 } 370out: 371 if (error == nfserr_stale) 372 nfsdstats.fh_stale++; 373 return error; 374} 375 --- 133 unchanged lines hidden (view full) --- 509 * if it is non-null and for the same filesystem, then we should compose 510 * a filehandle which is of the same version, where possible. 511 * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca 512 * Then create a 32byte filehandle using nfs_fhbase_old 513 * 514 */ 515 516 struct inode * inode = dentry->d_inode; | 367 access, ntohl(error)); 368 } 369out: 370 if (error == nfserr_stale) 371 nfsdstats.fh_stale++; 372 return error; 373} 374 --- 133 unchanged lines hidden (view full) --- 508 * if it is non-null and for the same filesystem, then we should compose 509 * a filehandle which is of the same version, where possible. 510 * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca 511 * Then create a 32byte filehandle using nfs_fhbase_old 512 * 513 */ 514 515 struct inode * inode = dentry->d_inode; |
517 struct dentry *parent = dentry->d_parent; | |
518 __u32 *datap; 519 dev_t ex_dev = exp_sb(exp)->s_dev; 520 | 516 __u32 *datap; 517 dev_t ex_dev = exp_sb(exp)->s_dev; 518 |
521 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", | 519 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n", |
522 MAJOR(ex_dev), MINOR(ex_dev), 523 (long) exp->ex_path.dentry->d_inode->i_ino, | 520 MAJOR(ex_dev), MINOR(ex_dev), 521 (long) exp->ex_path.dentry->d_inode->i_ino, |
524 parent->d_name.name, dentry->d_name.name, | 522 dentry, |
525 (inode ? inode->i_ino : 0)); 526 527 /* Choose filehandle version and fsid type based on 528 * the reference filehandle (if it is in the same export) 529 * or the export options. 530 */ 531 set_version_and_fsid_type(fhp, exp, ref_fh); 532 533 if (ref_fh == fhp) 534 fh_put(ref_fh); 535 536 if (fhp->fh_locked || fhp->fh_dentry) { | 523 (inode ? inode->i_ino : 0)); 524 525 /* Choose filehandle version and fsid type based on 526 * the reference filehandle (if it is in the same export) 527 * or the export options. 528 */ 529 set_version_and_fsid_type(fhp, exp, ref_fh); 530 531 if (ref_fh == fhp) 532 fh_put(ref_fh); 533 534 if (fhp->fh_locked || fhp->fh_dentry) { |
537 printk(KERN_ERR "fh_compose: fh %s/%s not initialized!\n", 538 parent->d_name.name, dentry->d_name.name); | 535 printk(KERN_ERR "fh_compose: fh %pd2 not initialized!\n", 536 dentry); |
539 } 540 if (fhp->fh_maxsize < NFS_FHSIZE) | 537 } 538 if (fhp->fh_maxsize < NFS_FHSIZE) |
541 printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n", | 539 printk(KERN_ERR "fh_compose: called with maxsize %d! %pd2\n", |
542 fhp->fh_maxsize, | 540 fhp->fh_maxsize, |
543 parent->d_name.name, dentry->d_name.name); | 541 dentry); |
544 545 fhp->fh_dentry = dget(dentry); /* our internal copy */ 546 fhp->fh_export = exp; 547 cache_get(&exp->h); 548 549 if (fhp->fh_handle.fh_version == 0xca) { 550 /* old style filehandle please */ 551 memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); --- 56 unchanged lines hidden (view full) --- 608 } 609out: 610 return 0; 611 612out_bad: 613 printk(KERN_ERR "fh_update: fh not verified!\n"); 614 goto out; 615out_negative: | 542 543 fhp->fh_dentry = dget(dentry); /* our internal copy */ 544 fhp->fh_export = exp; 545 cache_get(&exp->h); 546 547 if (fhp->fh_handle.fh_version == 0xca) { 548 /* old style filehandle please */ 549 memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); --- 56 unchanged lines hidden (view full) --- 606 } 607out: 608 return 0; 609 610out_bad: 611 printk(KERN_ERR "fh_update: fh not verified!\n"); 612 goto out; 613out_negative: |
616 printk(KERN_ERR "fh_update: %s/%s still negative!\n", 617 dentry->d_parent->d_name.name, dentry->d_name.name); | 614 printk(KERN_ERR "fh_update: %pd2 still negative!\n", 615 dentry); |
618 goto out; 619} 620 621/* 622 * Release a file handle. 623 */ 624void 625fh_put(struct svc_fh *fhp) --- 66 unchanged lines hidden --- | 616 goto out; 617} 618 619/* 620 * Release a file handle. 621 */ 622void 623fh_put(struct svc_fh *fhp) --- 66 unchanged lines hidden --- |