diff options
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index d1c5f787b365..44aa92aba891 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -744,45 +744,16 @@ nfsd_close(struct file *filp) | |||
744 | fput(filp); | 744 | fput(filp); |
745 | } | 745 | } |
746 | 746 | ||
747 | /* | ||
748 | * Sync a file | ||
749 | * As this calls fsync (not fdatasync) there is no need for a write_inode | ||
750 | * after it. | ||
751 | */ | ||
752 | static inline int nfsd_dosync(struct file *filp, struct dentry *dp, | ||
753 | const struct file_operations *fop) | ||
754 | { | ||
755 | struct inode *inode = dp->d_inode; | ||
756 | int (*fsync) (struct file *, struct dentry *, int); | ||
757 | int err; | ||
758 | |||
759 | err = filemap_fdatawrite(inode->i_mapping); | ||
760 | if (err == 0 && fop && (fsync = fop->fsync)) | ||
761 | err = fsync(filp, dp, 0); | ||
762 | if (err == 0) | ||
763 | err = filemap_fdatawait(inode->i_mapping); | ||
764 | |||
765 | return err; | ||
766 | } | ||
767 | |||
768 | |||
769 | static int | 747 | static int |
770 | nfsd_sync(struct file *filp) | 748 | nfsd_sync(struct file *filp) |
771 | { | 749 | { |
772 | int err; | 750 | return vfs_fsync(filp, filp->f_path.dentry, 0); |
773 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
774 | dprintk("nfsd: sync file %s\n", filp->f_path.dentry->d_name.name); | ||
775 | mutex_lock(&inode->i_mutex); | ||
776 | err=nfsd_dosync(filp, filp->f_path.dentry, filp->f_op); | ||
777 | mutex_unlock(&inode->i_mutex); | ||
778 | |||
779 | return err; | ||
780 | } | 751 | } |
781 | 752 | ||
782 | int | 753 | int |
783 | nfsd_sync_dir(struct dentry *dp) | 754 | nfsd_sync_dir(struct dentry *dentry) |
784 | { | 755 | { |
785 | return nfsd_dosync(NULL, dp, dp->d_inode->i_fop); | 756 | return vfs_fsync(NULL, dentry, 0); |
786 | } | 757 | } |
787 | 758 | ||
788 | /* | 759 | /* |
@@ -1211,7 +1182,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1211 | dirp = dentry->d_inode; | 1182 | dirp = dentry->d_inode; |
1212 | 1183 | ||
1213 | err = nfserr_notdir; | 1184 | err = nfserr_notdir; |
1214 | if(!dirp->i_op || !dirp->i_op->lookup) | 1185 | if (!dirp->i_op->lookup) |
1215 | goto out; | 1186 | goto out; |
1216 | /* | 1187 | /* |
1217 | * Check whether the response file handle has been verified yet. | 1188 | * Check whether the response file handle has been verified yet. |
@@ -1347,7 +1318,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1347 | /* Get all the sanity checks out of the way before | 1318 | /* Get all the sanity checks out of the way before |
1348 | * we lock the parent. */ | 1319 | * we lock the parent. */ |
1349 | err = nfserr_notdir; | 1320 | err = nfserr_notdir; |
1350 | if(!dirp->i_op || !dirp->i_op->lookup) | 1321 | if (!dirp->i_op->lookup) |
1351 | goto out; | 1322 | goto out; |
1352 | fh_lock_nested(fhp, I_MUTEX_PARENT); | 1323 | fh_lock_nested(fhp, I_MUTEX_PARENT); |
1353 | 1324 | ||
@@ -1482,7 +1453,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) | |||
1482 | inode = dentry->d_inode; | 1453 | inode = dentry->d_inode; |
1483 | 1454 | ||
1484 | err = nfserr_inval; | 1455 | err = nfserr_inval; |
1485 | if (!inode->i_op || !inode->i_op->readlink) | 1456 | if (!inode->i_op->readlink) |
1486 | goto out; | 1457 | goto out; |
1487 | 1458 | ||
1488 | touch_atime(fhp->fh_export->ex_path.mnt, dentry); | 1459 | touch_atime(fhp->fh_export->ex_path.mnt, dentry); |
@@ -2162,7 +2133,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
2162 | size_t size; | 2133 | size_t size; |
2163 | int error; | 2134 | int error; |
2164 | 2135 | ||
2165 | if (!IS_POSIXACL(inode) || !inode->i_op || | 2136 | if (!IS_POSIXACL(inode) || |
2166 | !inode->i_op->setxattr || !inode->i_op->removexattr) | 2137 | !inode->i_op->setxattr || !inode->i_op->removexattr) |
2167 | return -EOPNOTSUPP; | 2138 | return -EOPNOTSUPP; |
2168 | switch(type) { | 2139 | switch(type) { |