.. | .. |
---|
51 | 51 | struct nfs_access_entry { |
---|
52 | 52 | struct rb_node rb_node; |
---|
53 | 53 | struct list_head lru; |
---|
54 | | - struct rpc_cred * cred; |
---|
| 54 | + const struct cred * cred; |
---|
55 | 55 | __u32 mask; |
---|
56 | 56 | struct rcu_head rcu_head; |
---|
57 | 57 | }; |
---|
.. | .. |
---|
62 | 62 | struct nfs_open_context *open_context; |
---|
63 | 63 | fl_owner_t lockowner; |
---|
64 | 64 | atomic_t io_count; |
---|
| 65 | + struct rcu_head rcu_head; |
---|
65 | 66 | }; |
---|
66 | 67 | |
---|
67 | 68 | struct nfs4_state; |
---|
.. | .. |
---|
69 | 70 | struct nfs_lock_context lock_context; |
---|
70 | 71 | fl_owner_t flock_owner; |
---|
71 | 72 | struct dentry *dentry; |
---|
72 | | - struct rpc_cred *cred; |
---|
| 73 | + const struct cred *cred; |
---|
| 74 | + struct rpc_cred *ll_cred; /* low-level cred - use to check for expiry */ |
---|
73 | 75 | struct nfs4_state *state; |
---|
74 | 76 | fmode_t mode; |
---|
75 | 77 | |
---|
76 | 78 | unsigned long flags; |
---|
77 | | -#define NFS_CONTEXT_ERROR_WRITE (0) |
---|
78 | 79 | #define NFS_CONTEXT_RESEND_WRITES (1) |
---|
79 | 80 | #define NFS_CONTEXT_BAD (2) |
---|
80 | 81 | #define NFS_CONTEXT_UNLOCK (3) |
---|
.. | .. |
---|
83 | 84 | |
---|
84 | 85 | struct list_head list; |
---|
85 | 86 | struct nfs4_threshold *mdsthreshold; |
---|
| 87 | + struct rcu_head rcu_head; |
---|
86 | 88 | }; |
---|
87 | 89 | |
---|
88 | 90 | struct nfs_open_dir_context { |
---|
89 | 91 | struct list_head list; |
---|
90 | | - struct rpc_cred *cred; |
---|
| 92 | + const struct cred *cred; |
---|
91 | 93 | unsigned long attr_gencount; |
---|
92 | 94 | __u64 dir_cookie; |
---|
93 | 95 | __u64 dup_cookie; |
---|
.. | .. |
---|
100 | 102 | struct nfs_delegation; |
---|
101 | 103 | |
---|
102 | 104 | struct posix_acl; |
---|
| 105 | + |
---|
| 106 | +struct nfs4_xattr_cache; |
---|
103 | 107 | |
---|
104 | 108 | /* |
---|
105 | 109 | * nfs fs inode data in memory |
---|
.. | .. |
---|
164 | 168 | |
---|
165 | 169 | /* Readers: in-flight sillydelete RPC calls */ |
---|
166 | 170 | /* Writers: rmdir */ |
---|
167 | | -#ifdef CONFIG_PREEMPT_RT_BASE |
---|
168 | | - struct semaphore rmdir_sem; |
---|
169 | | -#else |
---|
170 | 171 | struct rw_semaphore rmdir_sem; |
---|
171 | | -#endif |
---|
172 | 172 | struct mutex commit_mutex; |
---|
| 173 | + |
---|
| 174 | + /* track last access to cached pages */ |
---|
| 175 | + unsigned long page_index; |
---|
173 | 176 | |
---|
174 | 177 | #if IS_ENABLED(CONFIG_NFS_V4) |
---|
175 | 178 | struct nfs4_cached_acl *nfs4_acl; |
---|
.. | .. |
---|
188 | 191 | struct fscache_cookie *fscache; |
---|
189 | 192 | #endif |
---|
190 | 193 | struct inode vfs_inode; |
---|
| 194 | + |
---|
| 195 | +#ifdef CONFIG_NFS_V4_2 |
---|
| 196 | + struct nfs4_xattr_cache *xattr_cache; |
---|
| 197 | +#endif |
---|
191 | 198 | }; |
---|
192 | 199 | |
---|
193 | 200 | struct nfs4_copy_state { |
---|
194 | 201 | struct list_head copies; |
---|
| 202 | + struct list_head src_copies; |
---|
195 | 203 | nfs4_stateid stateid; |
---|
196 | 204 | struct completion completion; |
---|
197 | 205 | uint64_t count; |
---|
198 | 206 | struct nfs_writeverf verf; |
---|
199 | 207 | int error; |
---|
200 | 208 | int flags; |
---|
201 | | - struct nfs4_state *parent_state; |
---|
| 209 | + struct nfs4_state *parent_src_state; |
---|
| 210 | + struct nfs4_state *parent_dst_state; |
---|
202 | 211 | }; |
---|
203 | 212 | |
---|
204 | 213 | /* |
---|
.. | .. |
---|
210 | 219 | #define NFS_ACCESS_EXTEND 0x0008 |
---|
211 | 220 | #define NFS_ACCESS_DELETE 0x0010 |
---|
212 | 221 | #define NFS_ACCESS_EXECUTE 0x0020 |
---|
| 222 | +#define NFS_ACCESS_XAREAD 0x0040 |
---|
| 223 | +#define NFS_ACCESS_XAWRITE 0x0080 |
---|
| 224 | +#define NFS_ACCESS_XALIST 0x0100 |
---|
213 | 225 | |
---|
214 | 226 | /* |
---|
215 | 227 | * Cache validity bit flags |
---|
.. | .. |
---|
226 | 238 | #define NFS_INO_INVALID_MTIME BIT(10) /* cached mtime is invalid */ |
---|
227 | 239 | #define NFS_INO_INVALID_SIZE BIT(11) /* cached size is invalid */ |
---|
228 | 240 | #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ |
---|
| 241 | +#define NFS_INO_DATA_INVAL_DEFER \ |
---|
| 242 | + BIT(13) /* Deferred cache invalidation */ |
---|
| 243 | +#define NFS_INO_INVALID_BLOCKS BIT(14) /* cached blocks are invalid */ |
---|
| 244 | +#define NFS_INO_INVALID_XATTR BIT(15) /* xattrs are invalid */ |
---|
229 | 245 | |
---|
230 | 246 | #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
---|
231 | 247 | | NFS_INO_INVALID_CTIME \ |
---|
.. | .. |
---|
333 | 349 | return NFS_SERVER(inode)->caps & cap; |
---|
334 | 350 | } |
---|
335 | 351 | |
---|
336 | | -static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) |
---|
337 | | -{ |
---|
338 | | - dentry->d_time = verf; |
---|
339 | | -} |
---|
340 | | - |
---|
341 | 352 | /** |
---|
342 | 353 | * nfs_save_change_attribute - Returns the inode attribute change cookie |
---|
343 | 354 | * @dir - pointer to parent directory inode |
---|
344 | | - * The "change attribute" is updated every time we finish an operation |
---|
345 | | - * that will result in a metadata change on the server. |
---|
| 355 | + * The "cache change attribute" is updated when we need to revalidate |
---|
| 356 | + * our dentry cache after a directory was seen to change on the server. |
---|
346 | 357 | */ |
---|
347 | 358 | static inline unsigned long nfs_save_change_attribute(struct inode *dir) |
---|
348 | 359 | { |
---|
349 | 360 | return NFS_I(dir)->cache_change_attribute; |
---|
350 | | -} |
---|
351 | | - |
---|
352 | | -/** |
---|
353 | | - * nfs_verify_change_attribute - Detects NFS remote directory changes |
---|
354 | | - * @dir - pointer to parent directory inode |
---|
355 | | - * @chattr - previously saved change attribute |
---|
356 | | - * Return "false" if the verifiers doesn't match the change attribute. |
---|
357 | | - * This would usually indicate that the directory contents have changed on |
---|
358 | | - * the server, and that any dentries need revalidating. |
---|
359 | | - */ |
---|
360 | | -static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr) |
---|
361 | | -{ |
---|
362 | | - return chattr == NFS_I(dir)->cache_change_attribute; |
---|
363 | 361 | } |
---|
364 | 362 | |
---|
365 | 363 | /* |
---|
.. | .. |
---|
368 | 366 | extern int nfs_sync_mapping(struct address_space *mapping); |
---|
369 | 367 | extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); |
---|
370 | 368 | extern void nfs_zap_caches(struct inode *); |
---|
| 369 | +extern void nfs_set_inode_stale(struct inode *inode); |
---|
371 | 370 | extern void nfs_invalidate_atime(struct inode *); |
---|
372 | 371 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
---|
373 | 372 | struct nfs_fattr *, struct nfs4_label *); |
---|
.. | .. |
---|
393 | 392 | struct nfs4_label *label); |
---|
394 | 393 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
---|
395 | 394 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
---|
396 | | -extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); |
---|
| 395 | +extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct cred *cred, fmode_t mode); |
---|
397 | 396 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode, struct file *filp); |
---|
398 | 397 | extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx); |
---|
399 | 398 | extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); |
---|
.. | .. |
---|
464 | 463 | return filp->private_data; |
---|
465 | 464 | } |
---|
466 | 465 | |
---|
467 | | -static inline struct rpc_cred *nfs_file_cred(struct file *file) |
---|
| 466 | +static inline const struct cred *nfs_file_cred(struct file *file) |
---|
468 | 467 | { |
---|
469 | 468 | if (file != NULL) { |
---|
470 | 469 | struct nfs_open_context *ctx = |
---|
.. | .. |
---|
479 | 478 | * linux/fs/nfs/direct.c |
---|
480 | 479 | */ |
---|
481 | 480 | extern ssize_t nfs_direct_IO(struct kiocb *, struct iov_iter *); |
---|
482 | | -extern ssize_t nfs_file_direct_read(struct kiocb *iocb, |
---|
483 | | - struct iov_iter *iter); |
---|
484 | | -extern ssize_t nfs_file_direct_write(struct kiocb *iocb, |
---|
485 | | - struct iov_iter *iter); |
---|
| 481 | +ssize_t nfs_file_direct_read(struct kiocb *iocb, |
---|
| 482 | + struct iov_iter *iter, bool swap); |
---|
| 483 | +ssize_t nfs_file_direct_write(struct kiocb *iocb, |
---|
| 484 | + struct iov_iter *iter, bool swap); |
---|
486 | 485 | |
---|
487 | 486 | /* |
---|
488 | 487 | * linux/fs/nfs/dir.c |
---|
.. | .. |
---|
491 | 490 | extern const struct dentry_operations nfs_dentry_operations; |
---|
492 | 491 | |
---|
493 | 492 | extern void nfs_force_lookup_revalidate(struct inode *dir); |
---|
| 493 | +extern void nfs_set_verifier(struct dentry * dentry, unsigned long verf); |
---|
| 494 | +#if IS_ENABLED(CONFIG_NFS_V4) |
---|
| 495 | +extern void nfs_clear_verifier_delegated(struct inode *inode); |
---|
| 496 | +#endif /* IS_ENABLED(CONFIG_NFS_V4) */ |
---|
| 497 | +extern struct dentry *nfs_add_or_obtain(struct dentry *dentry, |
---|
| 498 | + struct nfs_fh *fh, struct nfs_fattr *fattr, |
---|
| 499 | + struct nfs4_label *label); |
---|
494 | 500 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, |
---|
495 | 501 | struct nfs_fattr *fattr, struct nfs4_label *label); |
---|
496 | | -extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); |
---|
| 502 | +extern int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags); |
---|
497 | 503 | extern void nfs_access_zap_cache(struct inode *inode); |
---|
| 504 | +extern int nfs_access_get_cached(struct inode *inode, const struct cred *cred, |
---|
| 505 | + u32 *mask, bool may_block); |
---|
498 | 506 | |
---|
499 | 507 | /* |
---|
500 | 508 | * linux/fs/nfs/symlink.c |
---|
.. | .. |
---|
543 | 551 | extern int nfs_wb_page(struct inode *inode, struct page *page); |
---|
544 | 552 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); |
---|
545 | 553 | extern int nfs_commit_inode(struct inode *, int); |
---|
546 | | -extern struct nfs_commit_data *nfs_commitdata_alloc(bool never_fail); |
---|
| 554 | +extern struct nfs_commit_data *nfs_commitdata_alloc(void); |
---|
547 | 555 | extern void nfs_commit_free(struct nfs_commit_data *data); |
---|
| 556 | +bool nfs_commit_end(struct nfs_mds_commit_info *cinfo); |
---|
548 | 557 | |
---|
549 | 558 | static inline int |
---|
550 | 559 | nfs_have_writebacks(struct inode *inode) |
---|