diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/inode.c | 23 | ||||
-rw-r--r-- | fs/nfs/internal.h | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 39 | ||||
-rw-r--r-- | fs/nfs/write.c | 20 |
5 files changed, 41 insertions, 48 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e8877c82582d..a6ffa4be2a03 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -106,7 +106,7 @@ u64 nfs_compat_user_ino64(u64 fileid) | |||
106 | return ino; | 106 | return ino; |
107 | } | 107 | } |
108 | 108 | ||
109 | static void nfs_clear_inode(struct inode *inode) | 109 | void nfs_clear_inode(struct inode *inode) |
110 | { | 110 | { |
111 | /* | 111 | /* |
112 | * The following should never happen... | 112 | * The following should never happen... |
@@ -1472,27 +1472,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1472 | return -ESTALE; | 1472 | return -ESTALE; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | |||
1476 | #ifdef CONFIG_NFS_V4 | ||
1477 | |||
1478 | /* | ||
1479 | * Clean out any remaining NFSv4 state that might be left over due | ||
1480 | * to open() calls that passed nfs_atomic_lookup, but failed to call | ||
1481 | * nfs_open(). | ||
1482 | */ | ||
1483 | void nfs4_evict_inode(struct inode *inode) | ||
1484 | { | ||
1485 | truncate_inode_pages(&inode->i_data, 0); | ||
1486 | clear_inode(inode); | ||
1487 | pnfs_return_layout(inode); | ||
1488 | pnfs_destroy_layout(NFS_I(inode)); | ||
1489 | /* If we are holding a delegation, return it! */ | ||
1490 | nfs_inode_return_delegation_noreclaim(inode); | ||
1491 | /* First call standard NFS clear_inode() code */ | ||
1492 | nfs_clear_inode(inode); | ||
1493 | } | ||
1494 | #endif | ||
1495 | |||
1496 | struct inode *nfs_alloc_inode(struct super_block *sb) | 1475 | struct inode *nfs_alloc_inode(struct super_block *sb) |
1497 | { | 1476 | { |
1498 | struct nfs_inode *nfsi; | 1477 | struct nfs_inode *nfsi; |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 17d14709e750..4174faf73ec1 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -319,10 +319,8 @@ extern struct workqueue_struct *nfsiod_workqueue; | |||
319 | extern struct inode *nfs_alloc_inode(struct super_block *sb); | 319 | extern struct inode *nfs_alloc_inode(struct super_block *sb); |
320 | extern void nfs_destroy_inode(struct inode *); | 320 | extern void nfs_destroy_inode(struct inode *); |
321 | extern int nfs_write_inode(struct inode *, struct writeback_control *); | 321 | extern int nfs_write_inode(struct inode *, struct writeback_control *); |
322 | extern void nfs_clear_inode(struct inode *); | ||
322 | extern void nfs_evict_inode(struct inode *); | 323 | extern void nfs_evict_inode(struct inode *); |
323 | #ifdef CONFIG_NFS_V4 | ||
324 | extern void nfs4_evict_inode(struct inode *); | ||
325 | #endif | ||
326 | void nfs_zap_acl_cache(struct inode *inode); | 324 | void nfs_zap_acl_cache(struct inode *inode); |
327 | extern int nfs_wait_bit_killable(void *word); | 325 | extern int nfs_wait_bit_killable(void *word); |
328 | 326 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index c321fb59d801..4811e1251d32 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -205,9 +205,6 @@ extern const struct dentry_operations nfs4_dentry_operations; | |||
205 | int nfs_atomic_open(struct inode *, struct dentry *, struct file *, | 205 | int nfs_atomic_open(struct inode *, struct dentry *, struct file *, |
206 | unsigned, umode_t, int *); | 206 | unsigned, umode_t, int *); |
207 | 207 | ||
208 | /* write.c */ | ||
209 | int nfs4_write_inode(struct inode *, struct writeback_control *); | ||
210 | |||
211 | /* nfs4namespace.c */ | 208 | /* nfs4namespace.c */ |
212 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); | 209 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); |
213 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | 210 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index c70e1730755c..1c825f3bef51 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -6,12 +6,16 @@ | |||
6 | #include <linux/nfs_idmap.h> | 6 | #include <linux/nfs_idmap.h> |
7 | #include <linux/nfs4_mount.h> | 7 | #include <linux/nfs4_mount.h> |
8 | #include <linux/nfs_fs.h> | 8 | #include <linux/nfs_fs.h> |
9 | #include "delegation.h" | ||
9 | #include "internal.h" | 10 | #include "internal.h" |
10 | #include "nfs4_fs.h" | 11 | #include "nfs4_fs.h" |
12 | #include "pnfs.h" | ||
11 | #include "nfs.h" | 13 | #include "nfs.h" |
12 | 14 | ||
13 | #define NFSDBG_FACILITY NFSDBG_VFS | 15 | #define NFSDBG_FACILITY NFSDBG_VFS |
14 | 16 | ||
17 | static int nfs4_write_inode(struct inode *inode, struct writeback_control *wbc); | ||
18 | static void nfs4_evict_inode(struct inode *inode); | ||
15 | static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type, | 19 | static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type, |
16 | int flags, const char *dev_name, void *raw_data); | 20 | int flags, const char *dev_name, void *raw_data); |
17 | static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type, | 21 | static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type, |
@@ -75,6 +79,41 @@ struct nfs_subversion nfs_v4 = { | |||
75 | .xattr = nfs4_xattr_handlers, | 79 | .xattr = nfs4_xattr_handlers, |
76 | }; | 80 | }; |
77 | 81 | ||
82 | static int nfs4_write_inode(struct inode *inode, struct writeback_control *wbc) | ||
83 | { | ||
84 | int ret = nfs_write_inode(inode, wbc); | ||
85 | |||
86 | if (ret >= 0 && test_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags)) { | ||
87 | int status; | ||
88 | bool sync = true; | ||
89 | |||
90 | if (wbc->sync_mode == WB_SYNC_NONE) | ||
91 | sync = false; | ||
92 | |||
93 | status = pnfs_layoutcommit_inode(inode, sync); | ||
94 | if (status < 0) | ||
95 | return status; | ||
96 | } | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * Clean out any remaining NFSv4 state that might be left over due | ||
102 | * to open() calls that passed nfs_atomic_lookup, but failed to call | ||
103 | * nfs_open(). | ||
104 | */ | ||
105 | static void nfs4_evict_inode(struct inode *inode) | ||
106 | { | ||
107 | truncate_inode_pages(&inode->i_data, 0); | ||
108 | clear_inode(inode); | ||
109 | pnfs_return_layout(inode); | ||
110 | pnfs_destroy_layout(NFS_I(inode)); | ||
111 | /* If we are holding a delegation, return it! */ | ||
112 | nfs_inode_return_delegation_noreclaim(inode); | ||
113 | /* First call standard NFS clear_inode() code */ | ||
114 | nfs_clear_inode(inode); | ||
115 | } | ||
116 | |||
78 | /* | 117 | /* |
79 | * Get the superblock for the NFS4 root partition | 118 | * Get the superblock for the NFS4 root partition |
80 | */ | 119 | */ |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f312860c15d0..6ddac54dc67f 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1674,26 +1674,6 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
1674 | return nfs_commit_unstable_pages(inode, wbc); | 1674 | return nfs_commit_unstable_pages(inode, wbc); |
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | #ifdef CONFIG_NFS_V4 | ||
1678 | int nfs4_write_inode(struct inode *inode, struct writeback_control *wbc) | ||
1679 | { | ||
1680 | int ret = nfs_write_inode(inode, wbc); | ||
1681 | |||
1682 | if (ret >= 0 && test_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags)) { | ||
1683 | int status; | ||
1684 | bool sync = true; | ||
1685 | |||
1686 | if (wbc->sync_mode == WB_SYNC_NONE) | ||
1687 | sync = false; | ||
1688 | |||
1689 | status = pnfs_layoutcommit_inode(inode, sync); | ||
1690 | if (status < 0) | ||
1691 | return status; | ||
1692 | } | ||
1693 | return ret; | ||
1694 | } | ||
1695 | #endif | ||
1696 | |||
1697 | /* | 1677 | /* |
1698 | * flush the inode to disk. | 1678 | * flush the inode to disk. |
1699 | */ | 1679 | */ |