Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use struct path in struct svc_export

I'm embedding struct path into struct svc_export.

[akpm@linux-foundation.org: coding-style fixes]
[ezk@cs.sunysb.edu: NFSD: fix wrong mnt_writer count in rename]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: J. Bruce Fields <bfields@citi.umich.edu>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Blunck and committed by
Linus Torvalds
54775491 448678a0

+67 -70
+32 -35
fs/nfsd/export.c
··· 332 332 static void svc_export_put(struct kref *ref) 333 333 { 334 334 struct svc_export *exp = container_of(ref, struct svc_export, h.ref); 335 - dput(exp->ex_dentry); 336 - mntput(exp->ex_mnt); 335 + path_put(&exp->ex_path); 337 336 auth_domain_put(exp->ex_client); 338 - kfree(exp->ex_path); 337 + kfree(exp->ex_pathname); 339 338 nfsd4_fslocs_free(&exp->ex_fslocs); 340 339 kfree(exp); 341 340 } ··· 348 349 char *pth; 349 350 350 351 qword_add(bpp, blen, exp->ex_client->name); 351 - pth = d_path(exp->ex_dentry, exp->ex_mnt, *bpp, *blen); 352 + pth = d_path(exp->ex_path.dentry, exp->ex_path.mnt, *bpp, *blen); 352 353 if (IS_ERR(pth)) { 353 354 /* is this correct? */ 354 355 (*bpp)[0] = '\n'; ··· 507 508 int an_int; 508 509 509 510 nd.path.dentry = NULL; 510 - exp.ex_path = NULL; 511 + exp.ex_pathname = NULL; 511 512 512 513 /* fs locations */ 513 514 exp.ex_fslocs.locations = NULL; ··· 546 547 547 548 exp.h.flags = 0; 548 549 exp.ex_client = dom; 549 - exp.ex_mnt = nd.path.mnt; 550 - exp.ex_dentry = nd.path.dentry; 551 - exp.ex_path = kstrdup(buf, GFP_KERNEL); 550 + exp.ex_path.mnt = nd.path.mnt; 551 + exp.ex_path.dentry = nd.path.dentry; 552 + exp.ex_pathname = kstrdup(buf, GFP_KERNEL); 552 553 err = -ENOMEM; 553 - if (!exp.ex_path) 554 + if (!exp.ex_pathname) 554 555 goto out; 555 556 556 557 /* expiry */ ··· 627 628 out: 628 629 nfsd4_fslocs_free(&exp.ex_fslocs); 629 630 kfree(exp.ex_uuid); 630 - kfree(exp.ex_path); 631 + kfree(exp.ex_pathname); 631 632 if (nd.path.dentry) 632 633 path_put(&nd.path); 633 634 out_no_path: ··· 652 653 return 0; 653 654 } 654 655 exp = container_of(h, struct svc_export, h); 655 - seq_path(m, exp->ex_mnt, exp->ex_dentry, " \t\n\\"); 656 + seq_path(m, exp->ex_path.mnt, exp->ex_path.dentry, " \t\n\\"); 656 657 seq_putc(m, '\t'); 657 658 seq_escape(m, exp->ex_client->name, " \t\n\\"); 658 659 seq_putc(m, '('); ··· 679 680 struct svc_export *orig = container_of(a, struct svc_export, h); 680 681 struct svc_export *new = container_of(b, struct svc_export, h); 681 682 return orig->ex_client == new->ex_client && 682 - orig->ex_dentry == new->ex_dentry && 683 - orig->ex_mnt == new->ex_mnt; 683 + orig->ex_path.dentry == new->ex_path.dentry && 684 + orig->ex_path.mnt == new->ex_path.mnt; 684 685 } 685 686 686 687 static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) ··· 690 691 691 692 kref_get(&item->ex_client->ref); 692 693 new->ex_client = item->ex_client; 693 - new->ex_dentry = dget(item->ex_dentry); 694 - new->ex_mnt = mntget(item->ex_mnt); 695 - new->ex_path = NULL; 694 + new->ex_path.dentry = dget(item->ex_path.dentry); 695 + new->ex_path.mnt = mntget(item->ex_path.mnt); 696 + new->ex_pathname = NULL; 696 697 new->ex_fslocs.locations = NULL; 697 698 new->ex_fslocs.locations_count = 0; 698 699 new->ex_fslocs.migrated = 0; ··· 710 711 new->ex_fsid = item->ex_fsid; 711 712 new->ex_uuid = item->ex_uuid; 712 713 item->ex_uuid = NULL; 713 - new->ex_path = item->ex_path; 714 - item->ex_path = NULL; 714 + new->ex_pathname = item->ex_pathname; 715 + item->ex_pathname = NULL; 715 716 new->ex_fslocs.locations = item->ex_fslocs.locations; 716 717 item->ex_fslocs.locations = NULL; 717 718 new->ex_fslocs.locations_count = item->ex_fslocs.locations_count; ··· 754 755 struct cache_head *ch; 755 756 int hash; 756 757 hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS); 757 - hash ^= hash_ptr(exp->ex_dentry, EXPORT_HASHBITS); 758 - hash ^= hash_ptr(exp->ex_mnt, EXPORT_HASHBITS); 758 + hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS); 759 + hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS); 759 760 760 761 ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h, 761 762 hash); ··· 771 772 struct cache_head *ch; 772 773 int hash; 773 774 hash = hash_ptr(old->ex_client, EXPORT_HASHBITS); 774 - hash ^= hash_ptr(old->ex_dentry, EXPORT_HASHBITS); 775 - hash ^= hash_ptr(old->ex_mnt, EXPORT_HASHBITS); 775 + hash ^= hash_ptr(old->ex_path.dentry, EXPORT_HASHBITS); 776 + hash ^= hash_ptr(old->ex_path.mnt, EXPORT_HASHBITS); 776 777 777 778 ch = sunrpc_cache_update(&svc_export_cache, &new->h, 778 779 &old->h, ··· 814 815 key.ek_client = clp; 815 816 key.ek_fsidtype = fsid_type; 816 817 memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 817 - key.ek_mnt = exp->ex_mnt; 818 - key.ek_dentry = exp->ex_dentry; 818 + key.ek_mnt = exp->ex_path.mnt; 819 + key.ek_dentry = exp->ex_path.dentry; 819 820 key.h.expiry_time = NEVER; 820 821 key.h.flags = 0; 821 822 ··· 869 870 return ERR_PTR(-ENOENT); 870 871 871 872 key.ex_client = clp; 872 - key.ex_mnt = mnt; 873 - key.ex_dentry = dentry; 873 + key.ex_path.mnt = mnt; 874 + key.ex_path.dentry = dentry; 874 875 875 876 exp = svc_export_lookup(&key); 876 877 if (exp == NULL) ··· 967 968 static int exp_hash(struct auth_domain *clp, struct svc_export *exp) 968 969 { 969 970 u32 fsid[2]; 970 - struct inode *inode = exp->ex_dentry->d_inode; 971 + struct inode *inode = exp->ex_path.dentry->d_inode; 971 972 dev_t dev = inode->i_sb->s_dev; 972 973 973 974 if (old_valid_dev(dev)) { ··· 981 982 static void exp_unhash(struct svc_export *exp) 982 983 { 983 984 struct svc_expkey *ek; 984 - struct inode *inode = exp->ex_dentry->d_inode; 985 + struct inode *inode = exp->ex_path.dentry->d_inode; 985 986 986 987 ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino); 987 988 if (!IS_ERR(ek)) { ··· 1063 1064 1064 1065 new.h.expiry_time = NEVER; 1065 1066 new.h.flags = 0; 1066 - new.ex_path = kstrdup(nxp->ex_path, GFP_KERNEL); 1067 - if (!new.ex_path) 1067 + new.ex_pathname = kstrdup(nxp->ex_path, GFP_KERNEL); 1068 + if (!new.ex_pathname) 1068 1069 goto finish; 1069 1070 new.ex_client = clp; 1070 - new.ex_mnt = nd.path.mnt; 1071 - new.ex_dentry = nd.path.dentry; 1071 + new.ex_path = nd.path; 1072 1072 new.ex_flags = nxp->ex_flags; 1073 1073 new.ex_anon_uid = nxp->ex_anon_uid; 1074 1074 new.ex_anon_gid = nxp->ex_anon_gid; ··· 1088 1090 } else 1089 1091 err = 0; 1090 1092 finish: 1091 - if (new.ex_path) 1092 - kfree(new.ex_path); 1093 + kfree(new.ex_pathname); 1093 1094 if (exp) 1094 1095 exp_put(exp); 1095 1096 if (fsid_key && !IS_ERR(fsid_key)) ··· 1357 1360 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); 1358 1361 if (IS_ERR(exp)) 1359 1362 return nfserrno(PTR_ERR(exp)); 1360 - rv = fh_compose(fhp, exp, exp->ex_dentry, NULL); 1363 + rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL); 1361 1364 if (rv) 1362 1365 goto out; 1363 1366 rv = check_nfsd_access(exp, rqstp);
+1 -1
fs/nfsd/nfs3proc.c
··· 67 67 if (nfserr) 68 68 RETURN_STATUS(nfserr); 69 69 70 - err = vfs_getattr(resp->fh.fh_export->ex_mnt, 70 + err = vfs_getattr(resp->fh.fh_export->ex_path.mnt, 71 71 resp->fh.fh_dentry, &resp->stat); 72 72 nfserr = nfserrno(err); 73 73
+2 -2
fs/nfsd/nfs3xdr.c
··· 218 218 int err; 219 219 struct kstat stat; 220 220 221 - err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat); 221 + err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat); 222 222 if (!err) { 223 223 *p++ = xdr_one; /* attributes follow */ 224 224 lease_get_mtime(dentry->d_inode, &stat.mtime); ··· 270 270 if (fhp->fh_post_saved) 271 271 printk("nfsd: inode locked twice during operation.\n"); 272 272 273 - err = vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, 273 + err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, 274 274 &fhp->fh_post_attr); 275 275 if (err) 276 276 fhp->fh_post_saved = 0;
+6 -6
fs/nfsd/nfs4xdr.c
··· 1330 1330 *stat = exp_pseudoroot(rqstp, &tmp_fh); 1331 1331 if (*stat) 1332 1332 return NULL; 1333 - rootpath = tmp_fh.fh_export->ex_path; 1333 + rootpath = tmp_fh.fh_export->ex_pathname; 1334 1334 1335 - path = exp->ex_path; 1335 + path = exp->ex_pathname; 1336 1336 1337 1337 if (strncmp(path, rootpath, strlen(rootpath))) { 1338 1338 dprintk("nfsd: fs_locations failed;" ··· 1481 1481 goto out; 1482 1482 } 1483 1483 1484 - err = vfs_getattr(exp->ex_mnt, dentry, &stat); 1484 + err = vfs_getattr(exp->ex_path.mnt, dentry, &stat); 1485 1485 if (err) 1486 1486 goto out_nfserr; 1487 1487 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | ··· 1838 1838 * and this is the root of a cross-mounted filesystem. 1839 1839 */ 1840 1840 if (ignore_crossmnt == 0 && 1841 - exp->ex_mnt->mnt_root->d_inode == dentry->d_inode) { 1842 - err = vfs_getattr(exp->ex_mnt->mnt_parent, 1843 - exp->ex_mnt->mnt_mountpoint, &stat); 1841 + exp->ex_path.mnt->mnt_root->d_inode == dentry->d_inode) { 1842 + err = vfs_getattr(exp->ex_path.mnt->mnt_parent, 1843 + exp->ex_path.mnt->mnt_mountpoint, &stat); 1844 1844 if (err) 1845 1845 goto out_nfserr; 1846 1846 }
+13 -13
fs/nfsd/nfsfh.c
··· 47 47 return 1; 48 48 49 49 tdentry = dget(dentry); 50 - while (tdentry != exp->ex_dentry && ! IS_ROOT(tdentry)) { 50 + while (tdentry != exp->ex_path.dentry && !IS_ROOT(tdentry)) { 51 51 /* make sure parents give x permission to user */ 52 52 int err; 53 53 parent = dget_parent(tdentry); ··· 59 59 dput(tdentry); 60 60 tdentry = parent; 61 61 } 62 - if (tdentry != exp->ex_dentry) 62 + if (tdentry != exp->ex_path.dentry) 63 63 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name); 64 - rv = (tdentry == exp->ex_dentry); 64 + rv = (tdentry == exp->ex_path.dentry); 65 65 dput(tdentry); 66 66 return rv; 67 67 } ··· 209 209 fileid_type = fh->fh_fileid_type; 210 210 211 211 if (fileid_type == FILEID_ROOT) 212 - dentry = dget(exp->ex_dentry); 212 + dentry = dget(exp->ex_path.dentry); 213 213 else { 214 - dentry = exportfs_decode_fh(exp->ex_mnt, fid, 214 + dentry = exportfs_decode_fh(exp->ex_path.mnt, fid, 215 215 data_left, fileid_type, 216 216 nfsd_acceptable, exp); 217 217 } ··· 299 299 static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, 300 300 struct dentry *dentry) 301 301 { 302 - if (dentry != exp->ex_dentry) { 302 + if (dentry != exp->ex_path.dentry) { 303 303 struct fid *fid = (struct fid *) 304 304 (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1); 305 305 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; ··· 344 344 struct inode * inode = dentry->d_inode; 345 345 struct dentry *parent = dentry->d_parent; 346 346 __u32 *datap; 347 - dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; 348 - int root_export = (exp->ex_dentry == exp->ex_dentry->d_sb->s_root); 347 + dev_t ex_dev = exp->ex_path.dentry->d_inode->i_sb->s_dev; 348 + int root_export = (exp->ex_path.dentry == exp->ex_path.dentry->d_sb->s_root); 349 349 350 350 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", 351 351 MAJOR(ex_dev), MINOR(ex_dev), 352 - (long) exp->ex_dentry->d_inode->i_ino, 352 + (long) exp->ex_path.dentry->d_inode->i_ino, 353 353 parent->d_name.name, dentry->d_name.name, 354 354 (inode ? inode->i_ino : 0)); 355 355 ··· 391 391 /* FALL THROUGH */ 392 392 case FSID_MAJOR_MINOR: 393 393 case FSID_ENCODE_DEV: 394 - if (!(exp->ex_dentry->d_inode->i_sb->s_type->fs_flags 394 + if (!(exp->ex_path.dentry->d_inode->i_sb->s_type->fs_flags 395 395 & FS_REQUIRES_DEV)) 396 396 goto retry; 397 397 break; ··· 454 454 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 455 455 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 456 456 fhp->fh_handle.ofh_xino = 457 - ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); 457 + ino_t_to_u32(exp->ex_path.dentry->d_inode->i_ino); 458 458 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 459 459 if (inode) 460 460 _fh_update_old(dentry, exp, &fhp->fh_handle); ··· 465 465 datap = fhp->fh_handle.fh_auth+0; 466 466 fhp->fh_handle.fh_fsid_type = fsid_type; 467 467 mk_fsid(fsid_type, datap, ex_dev, 468 - exp->ex_dentry->d_inode->i_ino, 468 + exp->ex_path.dentry->d_inode->i_ino, 469 469 exp->ex_fsid, exp->ex_uuid); 470 470 471 471 len = key_len(fsid_type); ··· 571 571 case FSID_DEV: 572 572 case FSID_ENCODE_DEV: 573 573 case FSID_MAJOR_MINOR: 574 - if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags 574 + if (fhp->fh_export->ex_path.dentry->d_inode->i_sb->s_type->fs_flags 575 575 & FS_REQUIRES_DEV) 576 576 return FSIDSOURCE_DEV; 577 577 break;
+3 -3
fs/nfsd/nfsproc.c
··· 41 41 nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) 42 42 { 43 43 if (err) return err; 44 - return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 44 + return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 45 45 resp->fh.fh_dentry, 46 46 &resp->stat)); 47 47 } ··· 49 49 nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) 50 50 { 51 51 if (err) return err; 52 - return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 52 + return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 53 53 resp->fh.fh_dentry, 54 54 &resp->stat)); 55 55 } ··· 164 164 &resp->count); 165 165 166 166 if (nfserr) return nfserr; 167 - return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 167 + return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 168 168 resp->fh.fh_dentry, 169 169 &resp->stat)); 170 170 }
+1 -1
fs/nfsd/nfsxdr.c
··· 207 207 __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 208 208 { 209 209 struct kstat stat; 210 - vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); 210 + vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat); 211 211 return encode_fattr(rqstp, p, fhp, &stat); 212 212 } 213 213
+7 -6
fs/nfsd/vfs.c
··· 101 101 { 102 102 struct svc_export *exp = *expp, *exp2 = NULL; 103 103 struct dentry *dentry = *dpp; 104 - struct vfsmount *mnt = mntget(exp->ex_mnt); 104 + struct vfsmount *mnt = mntget(exp->ex_path.mnt); 105 105 struct dentry *mounts = dget(dentry); 106 106 int err = 0; 107 107 ··· 156 156 if (isdotent(name, len)) { 157 157 if (len==1) 158 158 dentry = dget(dparent); 159 - else if (dparent != exp->ex_dentry) { 159 + else if (dparent != exp->ex_path.dentry) 160 160 dentry = dget_parent(dparent); 161 - } else if (!EX_NOHIDE(exp)) 161 + else if (!EX_NOHIDE(exp)) 162 162 dentry = dget(dparent); /* .. == . just like at / */ 163 163 else { 164 164 /* checking mountpoint crossing is very different when stepping up */ 165 165 struct svc_export *exp2 = NULL; 166 166 struct dentry *dp; 167 - struct vfsmount *mnt = mntget(exp->ex_mnt); 167 + struct vfsmount *mnt = mntget(exp->ex_path.mnt); 168 168 dentry = dget(dparent); 169 169 while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry)) 170 170 ; ··· 721 721 722 722 DQUOT_INIT(inode); 723 723 } 724 - *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); 724 + *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt), 725 + flags); 725 726 if (IS_ERR(*filp)) 726 727 host_err = PTR_ERR(*filp); 727 728 out_nfserr: ··· 1463 1462 if (!inode->i_op || !inode->i_op->readlink) 1464 1463 goto out; 1465 1464 1466 - touch_atime(fhp->fh_export->ex_mnt, dentry); 1465 + touch_atime(fhp->fh_export->ex_path.mnt, dentry); 1467 1466 /* N.B. Why does this call need a get_fs()?? 1468 1467 * Remove the set_fs and watch the fireworks:-) --okir 1469 1468 */
+2 -3
include/linux/nfsd/export.h
··· 84 84 struct cache_head h; 85 85 struct auth_domain * ex_client; 86 86 int ex_flags; 87 - struct vfsmount * ex_mnt; 88 - struct dentry * ex_dentry; 89 - char * ex_path; 87 + struct path ex_path; 88 + char *ex_pathname; 90 89 uid_t ex_anon_uid; 91 90 gid_t ex_anon_gid; 92 91 int ex_fsid;