diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-23 12:03:18 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:52:35 -0500 |
commit | bad0dcffc21d17a07dbb83a2bf764f35a57feba5 (patch) | |
tree | bb2ed8685bafc927df70307ba13df53469000255 /fs/nfsd | |
parent | a561be7100cd610bd2e082f3211c1dfb45835817 (diff) |
new helpers: fh_{want,drop}_write()
A bunch of places in nfsd does mnt_{want,drop}_write on vfsmount of
export of given fhandle. Switched to obvious inlined helpers...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 34 | ||||
-rw-r--r-- | fs/nfsd/vfs.h | 10 |
3 files changed, 29 insertions, 19 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index fa383361bc61..c5e28ed8bca0 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -838,7 +838,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
838 | return status; | 838 | return status; |
839 | } | 839 | } |
840 | } | 840 | } |
841 | status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt); | 841 | status = fh_want_write(&cstate->current_fh); |
842 | if (status) | 842 | if (status) |
843 | return status; | 843 | return status; |
844 | status = nfs_ok; | 844 | status = nfs_ok; |
@@ -856,7 +856,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
856 | status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr, | 856 | status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr, |
857 | 0, (time_t)0); | 857 | 0, (time_t)0); |
858 | out: | 858 | out: |
859 | mnt_drop_write(cstate->current_fh.fh_export->ex_path.mnt); | 859 | fh_drop_write(&cstate->current_fh); |
860 | return status; | 860 | return status; |
861 | } | 861 | } |
862 | 862 | ||
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 7a2e442623c8..29b1202313e9 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1300,7 +1300,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1300 | goto out; | 1300 | goto out; |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | host_err = mnt_want_write(fhp->fh_export->ex_path.mnt); | 1303 | host_err = fh_want_write(fhp); |
1304 | if (host_err) | 1304 | if (host_err) |
1305 | goto out_nfserr; | 1305 | goto out_nfserr; |
1306 | 1306 | ||
@@ -1325,7 +1325,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1325 | break; | 1325 | break; |
1326 | } | 1326 | } |
1327 | if (host_err < 0) { | 1327 | if (host_err < 0) { |
1328 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1328 | fh_drop_write(fhp); |
1329 | goto out_nfserr; | 1329 | goto out_nfserr; |
1330 | } | 1330 | } |
1331 | 1331 | ||
@@ -1339,7 +1339,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1339 | err2 = nfserrno(commit_metadata(fhp)); | 1339 | err2 = nfserrno(commit_metadata(fhp)); |
1340 | if (err2) | 1340 | if (err2) |
1341 | err = err2; | 1341 | err = err2; |
1342 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1342 | fh_drop_write(fhp); |
1343 | /* | 1343 | /* |
1344 | * Update the file handle to get the new inode info. | 1344 | * Update the file handle to get the new inode info. |
1345 | */ | 1345 | */ |
@@ -1430,7 +1430,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1430 | v_atime = verifier[1]&0x7fffffff; | 1430 | v_atime = verifier[1]&0x7fffffff; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | host_err = mnt_want_write(fhp->fh_export->ex_path.mnt); | 1433 | host_err = fh_want_write(fhp); |
1434 | if (host_err) | 1434 | if (host_err) |
1435 | goto out_nfserr; | 1435 | goto out_nfserr; |
1436 | if (dchild->d_inode) { | 1436 | if (dchild->d_inode) { |
@@ -1469,13 +1469,13 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1469 | case NFS3_CREATE_GUARDED: | 1469 | case NFS3_CREATE_GUARDED: |
1470 | err = nfserr_exist; | 1470 | err = nfserr_exist; |
1471 | } | 1471 | } |
1472 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1472 | fh_drop_write(fhp); |
1473 | goto out; | 1473 | goto out; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); | 1476 | host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); |
1477 | if (host_err < 0) { | 1477 | if (host_err < 0) { |
1478 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1478 | fh_drop_write(fhp); |
1479 | goto out_nfserr; | 1479 | goto out_nfserr; |
1480 | } | 1480 | } |
1481 | if (created) | 1481 | if (created) |
@@ -1503,7 +1503,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1503 | if (!err) | 1503 | if (!err) |
1504 | err = nfserrno(commit_metadata(fhp)); | 1504 | err = nfserrno(commit_metadata(fhp)); |
1505 | 1505 | ||
1506 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1506 | fh_drop_write(fhp); |
1507 | /* | 1507 | /* |
1508 | * Update the filehandle to get the new inode info. | 1508 | * Update the filehandle to get the new inode info. |
1509 | */ | 1509 | */ |
@@ -1600,7 +1600,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1600 | if (IS_ERR(dnew)) | 1600 | if (IS_ERR(dnew)) |
1601 | goto out_nfserr; | 1601 | goto out_nfserr; |
1602 | 1602 | ||
1603 | host_err = mnt_want_write(fhp->fh_export->ex_path.mnt); | 1603 | host_err = fh_want_write(fhp); |
1604 | if (host_err) | 1604 | if (host_err) |
1605 | goto out_nfserr; | 1605 | goto out_nfserr; |
1606 | 1606 | ||
@@ -1621,7 +1621,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1621 | err = nfserrno(commit_metadata(fhp)); | 1621 | err = nfserrno(commit_metadata(fhp)); |
1622 | fh_unlock(fhp); | 1622 | fh_unlock(fhp); |
1623 | 1623 | ||
1624 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1624 | fh_drop_write(fhp); |
1625 | 1625 | ||
1626 | cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); | 1626 | cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); |
1627 | dput(dnew); | 1627 | dput(dnew); |
@@ -1674,7 +1674,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
1674 | 1674 | ||
1675 | dold = tfhp->fh_dentry; | 1675 | dold = tfhp->fh_dentry; |
1676 | 1676 | ||
1677 | host_err = mnt_want_write(tfhp->fh_export->ex_path.mnt); | 1677 | host_err = fh_want_write(tfhp); |
1678 | if (host_err) { | 1678 | if (host_err) { |
1679 | err = nfserrno(host_err); | 1679 | err = nfserrno(host_err); |
1680 | goto out_dput; | 1680 | goto out_dput; |
@@ -1699,7 +1699,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
1699 | err = nfserrno(host_err); | 1699 | err = nfserrno(host_err); |
1700 | } | 1700 | } |
1701 | out_drop_write: | 1701 | out_drop_write: |
1702 | mnt_drop_write(tfhp->fh_export->ex_path.mnt); | 1702 | fh_drop_write(tfhp); |
1703 | out_dput: | 1703 | out_dput: |
1704 | dput(dnew); | 1704 | dput(dnew); |
1705 | out_unlock: | 1705 | out_unlock: |
@@ -1776,7 +1776,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1776 | host_err = -EXDEV; | 1776 | host_err = -EXDEV; |
1777 | if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) | 1777 | if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) |
1778 | goto out_dput_new; | 1778 | goto out_dput_new; |
1779 | host_err = mnt_want_write(ffhp->fh_export->ex_path.mnt); | 1779 | host_err = fh_want_write(ffhp); |
1780 | if (host_err) | 1780 | if (host_err) |
1781 | goto out_dput_new; | 1781 | goto out_dput_new; |
1782 | 1782 | ||
@@ -1795,7 +1795,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1795 | host_err = commit_metadata(ffhp); | 1795 | host_err = commit_metadata(ffhp); |
1796 | } | 1796 | } |
1797 | out_drop_write: | 1797 | out_drop_write: |
1798 | mnt_drop_write(ffhp->fh_export->ex_path.mnt); | 1798 | fh_drop_write(ffhp); |
1799 | out_dput_new: | 1799 | out_dput_new: |
1800 | dput(ndentry); | 1800 | dput(ndentry); |
1801 | out_dput_old: | 1801 | out_dput_old: |
@@ -1854,7 +1854,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
1854 | if (!type) | 1854 | if (!type) |
1855 | type = rdentry->d_inode->i_mode & S_IFMT; | 1855 | type = rdentry->d_inode->i_mode & S_IFMT; |
1856 | 1856 | ||
1857 | host_err = mnt_want_write(fhp->fh_export->ex_path.mnt); | 1857 | host_err = fh_want_write(fhp); |
1858 | if (host_err) | 1858 | if (host_err) |
1859 | goto out_put; | 1859 | goto out_put; |
1860 | 1860 | ||
@@ -1868,7 +1868,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
1868 | if (!host_err) | 1868 | if (!host_err) |
1869 | host_err = commit_metadata(fhp); | 1869 | host_err = commit_metadata(fhp); |
1870 | out_drop_write: | 1870 | out_drop_write: |
1871 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 1871 | fh_drop_write(fhp); |
1872 | out_put: | 1872 | out_put: |
1873 | dput(rdentry); | 1873 | dput(rdentry); |
1874 | 1874 | ||
@@ -2270,7 +2270,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
2270 | } else | 2270 | } else |
2271 | size = 0; | 2271 | size = 0; |
2272 | 2272 | ||
2273 | error = mnt_want_write(fhp->fh_export->ex_path.mnt); | 2273 | error = fh_want_write(fhp); |
2274 | if (error) | 2274 | if (error) |
2275 | goto getout; | 2275 | goto getout; |
2276 | if (size) | 2276 | if (size) |
@@ -2284,7 +2284,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
2284 | error = 0; | 2284 | error = 0; |
2285 | } | 2285 | } |
2286 | } | 2286 | } |
2287 | mnt_drop_write(fhp->fh_export->ex_path.mnt); | 2287 | fh_drop_write(fhp); |
2288 | 2288 | ||
2289 | getout: | 2289 | getout: |
2290 | kfree(value); | 2290 | kfree(value); |
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index 3f54ad03bb2b..cee6a12296e8 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h | |||
@@ -106,4 +106,14 @@ struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | |||
106 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | 106 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | static inline int fh_want_write(struct svc_fh *fh) | ||
110 | { | ||
111 | return mnt_want_write(fh->fh_export->ex_path.mnt); | ||
112 | } | ||
113 | |||
114 | static inline void fh_drop_write(struct svc_fh *fh) | ||
115 | { | ||
116 | mnt_drop_write(fh->fh_export->ex_path.mnt); | ||
117 | } | ||
118 | |||
109 | #endif /* LINUX_NFSD_VFS_H */ | 119 | #endif /* LINUX_NFSD_VFS_H */ |