aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/vfs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 14d582467029..71f899482306 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1542,6 +1542,10 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1542 if (iap && (iap->ia_valid & ATTR_MODE)) 1542 if (iap && (iap->ia_valid & ATTR_MODE))
1543 mode = iap->ia_mode & S_IALLUGO; 1543 mode = iap->ia_mode & S_IALLUGO;
1544 1544
1545 host_err = mnt_want_write(fhp->fh_export->ex_path.mnt);
1546 if (host_err)
1547 goto out_nfserr;
1548
1545 if (unlikely(path[plen] != 0)) { 1549 if (unlikely(path[plen] != 0)) {
1546 char *path_alloced = kmalloc(plen+1, GFP_KERNEL); 1550 char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
1547 if (path_alloced == NULL) 1551 if (path_alloced == NULL)
@@ -1562,6 +1566,8 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1562 err = nfserrno(host_err); 1566 err = nfserrno(host_err);
1563 fh_unlock(fhp); 1567 fh_unlock(fhp);
1564 1568
1569 mnt_drop_write(fhp->fh_export->ex_path.mnt);
1570
1565 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); 1571 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
1566 dput(dnew); 1572 dput(dnew);
1567 if (err==0) err = cerr; 1573 if (err==0) err = cerr;
@@ -1612,6 +1618,11 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1612 dold = tfhp->fh_dentry; 1618 dold = tfhp->fh_dentry;
1613 dest = dold->d_inode; 1619 dest = dold->d_inode;
1614 1620
1621 host_err = mnt_want_write(tfhp->fh_export->ex_path.mnt);
1622 if (host_err) {
1623 err = nfserrno(host_err);
1624 goto out_dput;
1625 }
1615 host_err = vfs_link(dold, dirp, dnew); 1626 host_err = vfs_link(dold, dirp, dnew);
1616 if (!host_err) { 1627 if (!host_err) {
1617 if (EX_ISSYNC(ffhp->fh_export)) { 1628 if (EX_ISSYNC(ffhp->fh_export)) {
@@ -1625,7 +1636,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1625 else 1636 else
1626 err = nfserrno(host_err); 1637 err = nfserrno(host_err);
1627 } 1638 }
1628 1639 mnt_drop_write(tfhp->fh_export->ex_path.mnt);
1640out_dput:
1629 dput(dnew); 1641 dput(dnew);
1630out_unlock: 1642out_unlock:
1631 fh_unlock(ffhp); 1643 fh_unlock(ffhp);