| .. | .. |
|---|
| 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 |
|---|
| .. | .. |
|---|
| 167 | 171 | struct rw_semaphore rmdir_sem; |
|---|
| 168 | 172 | struct mutex commit_mutex; |
|---|
| 169 | 173 | |
|---|
| 174 | + /* track last access to cached pages */ |
|---|
| 175 | + unsigned long page_index; |
|---|
| 176 | + |
|---|
| 170 | 177 | #if IS_ENABLED(CONFIG_NFS_V4) |
|---|
| 171 | 178 | struct nfs4_cached_acl *nfs4_acl; |
|---|
| 172 | 179 | /* NFSv4 state */ |
|---|
| .. | .. |
|---|
| 184 | 191 | struct fscache_cookie *fscache; |
|---|
| 185 | 192 | #endif |
|---|
| 186 | 193 | struct inode vfs_inode; |
|---|
| 194 | + |
|---|
| 195 | +#ifdef CONFIG_NFS_V4_2 |
|---|
| 196 | + struct nfs4_xattr_cache *xattr_cache; |
|---|
| 197 | +#endif |
|---|
| 187 | 198 | }; |
|---|
| 188 | 199 | |
|---|
| 189 | 200 | struct nfs4_copy_state { |
|---|
| 190 | 201 | struct list_head copies; |
|---|
| 202 | + struct list_head src_copies; |
|---|
| 191 | 203 | nfs4_stateid stateid; |
|---|
| 192 | 204 | struct completion completion; |
|---|
| 193 | 205 | uint64_t count; |
|---|
| 194 | 206 | struct nfs_writeverf verf; |
|---|
| 195 | 207 | int error; |
|---|
| 196 | 208 | int flags; |
|---|
| 197 | | - struct nfs4_state *parent_state; |
|---|
| 209 | + struct nfs4_state *parent_src_state; |
|---|
| 210 | + struct nfs4_state *parent_dst_state; |
|---|
| 198 | 211 | }; |
|---|
| 199 | 212 | |
|---|
| 200 | 213 | /* |
|---|
| .. | .. |
|---|
| 206 | 219 | #define NFS_ACCESS_EXTEND 0x0008 |
|---|
| 207 | 220 | #define NFS_ACCESS_DELETE 0x0010 |
|---|
| 208 | 221 | #define NFS_ACCESS_EXECUTE 0x0020 |
|---|
| 222 | +#define NFS_ACCESS_XAREAD 0x0040 |
|---|
| 223 | +#define NFS_ACCESS_XAWRITE 0x0080 |
|---|
| 224 | +#define NFS_ACCESS_XALIST 0x0100 |
|---|
| 209 | 225 | |
|---|
| 210 | 226 | /* |
|---|
| 211 | 227 | * Cache validity bit flags |
|---|
| .. | .. |
|---|
| 222 | 238 | #define NFS_INO_INVALID_MTIME BIT(10) /* cached mtime is invalid */ |
|---|
| 223 | 239 | #define NFS_INO_INVALID_SIZE BIT(11) /* cached size is invalid */ |
|---|
| 224 | 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 */ |
|---|
| 225 | 245 | |
|---|
| 226 | 246 | #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
|---|
| 227 | 247 | | NFS_INO_INVALID_CTIME \ |
|---|
| .. | .. |
|---|
| 329 | 349 | return NFS_SERVER(inode)->caps & cap; |
|---|
| 330 | 350 | } |
|---|
| 331 | 351 | |
|---|
| 332 | | -static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) |
|---|
| 333 | | -{ |
|---|
| 334 | | - dentry->d_time = verf; |
|---|
| 335 | | -} |
|---|
| 336 | | - |
|---|
| 337 | 352 | /** |
|---|
| 338 | 353 | * nfs_save_change_attribute - Returns the inode attribute change cookie |
|---|
| 339 | 354 | * @dir - pointer to parent directory inode |
|---|
| 340 | | - * The "change attribute" is updated every time we finish an operation |
|---|
| 341 | | - * 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. |
|---|
| 342 | 357 | */ |
|---|
| 343 | 358 | static inline unsigned long nfs_save_change_attribute(struct inode *dir) |
|---|
| 344 | 359 | { |
|---|
| 345 | 360 | return NFS_I(dir)->cache_change_attribute; |
|---|
| 346 | | -} |
|---|
| 347 | | - |
|---|
| 348 | | -/** |
|---|
| 349 | | - * nfs_verify_change_attribute - Detects NFS remote directory changes |
|---|
| 350 | | - * @dir - pointer to parent directory inode |
|---|
| 351 | | - * @chattr - previously saved change attribute |
|---|
| 352 | | - * Return "false" if the verifiers doesn't match the change attribute. |
|---|
| 353 | | - * This would usually indicate that the directory contents have changed on |
|---|
| 354 | | - * the server, and that any dentries need revalidating. |
|---|
| 355 | | - */ |
|---|
| 356 | | -static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr) |
|---|
| 357 | | -{ |
|---|
| 358 | | - return chattr == NFS_I(dir)->cache_change_attribute; |
|---|
| 359 | 361 | } |
|---|
| 360 | 362 | |
|---|
| 361 | 363 | /* |
|---|
| .. | .. |
|---|
| 364 | 366 | extern int nfs_sync_mapping(struct address_space *mapping); |
|---|
| 365 | 367 | extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); |
|---|
| 366 | 368 | extern void nfs_zap_caches(struct inode *); |
|---|
| 369 | +extern void nfs_set_inode_stale(struct inode *inode); |
|---|
| 367 | 370 | extern void nfs_invalidate_atime(struct inode *); |
|---|
| 368 | 371 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
|---|
| 369 | 372 | struct nfs_fattr *, struct nfs4_label *); |
|---|
| .. | .. |
|---|
| 389 | 392 | struct nfs4_label *label); |
|---|
| 390 | 393 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
|---|
| 391 | 394 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
|---|
| 392 | | -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); |
|---|
| 393 | 396 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode, struct file *filp); |
|---|
| 394 | 397 | extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx); |
|---|
| 395 | 398 | extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); |
|---|
| .. | .. |
|---|
| 460 | 463 | return filp->private_data; |
|---|
| 461 | 464 | } |
|---|
| 462 | 465 | |
|---|
| 463 | | -static inline struct rpc_cred *nfs_file_cred(struct file *file) |
|---|
| 466 | +static inline const struct cred *nfs_file_cred(struct file *file) |
|---|
| 464 | 467 | { |
|---|
| 465 | 468 | if (file != NULL) { |
|---|
| 466 | 469 | struct nfs_open_context *ctx = |
|---|
| .. | .. |
|---|
| 475 | 478 | * linux/fs/nfs/direct.c |
|---|
| 476 | 479 | */ |
|---|
| 477 | 480 | extern ssize_t nfs_direct_IO(struct kiocb *, struct iov_iter *); |
|---|
| 478 | | -extern ssize_t nfs_file_direct_read(struct kiocb *iocb, |
|---|
| 479 | | - struct iov_iter *iter); |
|---|
| 480 | | -extern ssize_t nfs_file_direct_write(struct kiocb *iocb, |
|---|
| 481 | | - 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); |
|---|
| 482 | 485 | |
|---|
| 483 | 486 | /* |
|---|
| 484 | 487 | * linux/fs/nfs/dir.c |
|---|
| .. | .. |
|---|
| 487 | 490 | extern const struct dentry_operations nfs_dentry_operations; |
|---|
| 488 | 491 | |
|---|
| 489 | 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); |
|---|
| 490 | 500 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, |
|---|
| 491 | 501 | struct nfs_fattr *fattr, struct nfs4_label *label); |
|---|
| 492 | | -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); |
|---|
| 493 | 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); |
|---|
| 494 | 506 | |
|---|
| 495 | 507 | /* |
|---|
| 496 | 508 | * linux/fs/nfs/symlink.c |
|---|
| .. | .. |
|---|
| 539 | 551 | extern int nfs_wb_page(struct inode *inode, struct page *page); |
|---|
| 540 | 552 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); |
|---|
| 541 | 553 | extern int nfs_commit_inode(struct inode *, int); |
|---|
| 542 | | -extern struct nfs_commit_data *nfs_commitdata_alloc(bool never_fail); |
|---|
| 554 | +extern struct nfs_commit_data *nfs_commitdata_alloc(void); |
|---|
| 543 | 555 | extern void nfs_commit_free(struct nfs_commit_data *data); |
|---|
| 556 | +bool nfs_commit_end(struct nfs_mds_commit_info *cinfo); |
|---|
| 544 | 557 | |
|---|
| 545 | 558 | static inline int |
|---|
| 546 | 559 | nfs_have_writebacks(struct inode *inode) |
|---|