| .. | .. |
|---|
| 42 | 42 | NFS4CLNT_LEASE_MOVED, |
|---|
| 43 | 43 | NFS4CLNT_DELEGATION_EXPIRED, |
|---|
| 44 | 44 | NFS4CLNT_RUN_MANAGER, |
|---|
| 45 | | - NFS4CLNT_DELEGRETURN_RUNNING, |
|---|
| 45 | + NFS4CLNT_RECALL_RUNNING, |
|---|
| 46 | + NFS4CLNT_RECALL_ANY_LAYOUT_READ, |
|---|
| 47 | + NFS4CLNT_RECALL_ANY_LAYOUT_RW, |
|---|
| 48 | + NFS4CLNT_DELEGRETURN_DELAYED, |
|---|
| 46 | 49 | }; |
|---|
| 47 | 50 | |
|---|
| 48 | 51 | #define NFS4_RENEW_TIMEOUT 0x01 |
|---|
| .. | .. |
|---|
| 62 | 65 | void (*free_lock_state)(struct nfs_server *, |
|---|
| 63 | 66 | struct nfs4_lock_state *); |
|---|
| 64 | 67 | int (*test_and_free_expired)(struct nfs_server *, |
|---|
| 65 | | - nfs4_stateid *, struct rpc_cred *); |
|---|
| 68 | + nfs4_stateid *, const struct cred *); |
|---|
| 66 | 69 | struct nfs_seqid * |
|---|
| 67 | 70 | (*alloc_seqid)(struct nfs_seqid_counter *, gfp_t); |
|---|
| 68 | | - int (*session_trunk)(struct rpc_clnt *, struct rpc_xprt *, void *); |
|---|
| 71 | + void (*session_trunk)(struct rpc_clnt *clnt, |
|---|
| 72 | + struct rpc_xprt *xprt, void *data); |
|---|
| 69 | 73 | const struct rpc_call_ops *call_sync_ops; |
|---|
| 70 | 74 | const struct nfs4_state_recovery_ops *reboot_recovery_ops; |
|---|
| 71 | 75 | const struct nfs4_state_recovery_ops *nograce_recovery_ops; |
|---|
| .. | .. |
|---|
| 107 | 111 | unsigned long so_expires; |
|---|
| 108 | 112 | struct rb_node so_server_node; |
|---|
| 109 | 113 | |
|---|
| 110 | | - struct rpc_cred *so_cred; /* Associated cred */ |
|---|
| 114 | + const struct cred *so_cred; /* Associated cred */ |
|---|
| 111 | 115 | |
|---|
| 112 | 116 | spinlock_t so_lock; |
|---|
| 113 | 117 | atomic_t so_count; |
|---|
| 114 | 118 | unsigned long so_flags; |
|---|
| 115 | 119 | struct list_head so_states; |
|---|
| 116 | 120 | struct nfs_seqid_counter so_seqid; |
|---|
| 117 | | - seqcount_t so_reclaim_seqcount; |
|---|
| 121 | + seqcount_spinlock_t so_reclaim_seqcount; |
|---|
| 118 | 122 | struct mutex so_delegreturn_mutex; |
|---|
| 119 | 123 | }; |
|---|
| 120 | 124 | |
|---|
| .. | .. |
|---|
| 165 | 169 | NFS_STATE_RECOVERY_FAILED, /* OPEN stateid state recovery failed */ |
|---|
| 166 | 170 | NFS_STATE_MAY_NOTIFY_LOCK, /* server may CB_NOTIFY_LOCK */ |
|---|
| 167 | 171 | NFS_STATE_CHANGE_WAIT, /* A state changing operation is outstanding */ |
|---|
| 168 | | -#ifdef CONFIG_NFS_V4_2 |
|---|
| 169 | 172 | NFS_CLNT_DST_SSC_COPY_STATE, /* dst server open state on client*/ |
|---|
| 170 | | -#endif /* CONFIG_NFS_V4_2 */ |
|---|
| 173 | + NFS_CLNT_SRC_SSC_COPY_STATE, /* src server open state on client*/ |
|---|
| 174 | + NFS_SRV_SSC_COPY_STATE, /* ssc state on the dst server */ |
|---|
| 171 | 175 | }; |
|---|
| 172 | 176 | |
|---|
| 173 | 177 | struct nfs4_state { |
|---|
| .. | .. |
|---|
| 190 | 194 | unsigned int n_wronly; /* Number of write-only references */ |
|---|
| 191 | 195 | unsigned int n_rdwr; /* Number of read/write references */ |
|---|
| 192 | 196 | fmode_t state; /* State on the server (R,W, or RW) */ |
|---|
| 193 | | - atomic_t count; |
|---|
| 197 | + refcount_t count; |
|---|
| 194 | 198 | |
|---|
| 195 | 199 | wait_queue_head_t waitq; |
|---|
| 200 | + struct rcu_head rcu_head; |
|---|
| 196 | 201 | }; |
|---|
| 197 | 202 | |
|---|
| 198 | 203 | |
|---|
| .. | .. |
|---|
| 205 | 210 | unsigned char delay : 1, |
|---|
| 206 | 211 | recovering : 1, |
|---|
| 207 | 212 | retry : 1; |
|---|
| 213 | + bool interruptible; |
|---|
| 208 | 214 | }; |
|---|
| 209 | 215 | |
|---|
| 210 | 216 | struct nfs4_state_recovery_ops { |
|---|
| .. | .. |
|---|
| 212 | 218 | int state_flag_bit; |
|---|
| 213 | 219 | int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); |
|---|
| 214 | 220 | int (*recover_lock)(struct nfs4_state *, struct file_lock *); |
|---|
| 215 | | - int (*establish_clid)(struct nfs_client *, struct rpc_cred *); |
|---|
| 216 | | - int (*reclaim_complete)(struct nfs_client *, struct rpc_cred *); |
|---|
| 221 | + int (*establish_clid)(struct nfs_client *, const struct cred *); |
|---|
| 222 | + int (*reclaim_complete)(struct nfs_client *, const struct cred *); |
|---|
| 217 | 223 | int (*detect_trunking)(struct nfs_client *, struct nfs_client **, |
|---|
| 218 | | - struct rpc_cred *); |
|---|
| 224 | + const struct cred *); |
|---|
| 219 | 225 | }; |
|---|
| 220 | 226 | |
|---|
| 221 | 227 | struct nfs4_opendata { |
|---|
| .. | .. |
|---|
| 245 | 251 | |
|---|
| 246 | 252 | struct nfs4_add_xprt_data { |
|---|
| 247 | 253 | struct nfs_client *clp; |
|---|
| 248 | | - struct rpc_cred *cred; |
|---|
| 254 | + const struct cred *cred; |
|---|
| 249 | 255 | }; |
|---|
| 250 | 256 | |
|---|
| 251 | 257 | struct nfs4_state_maintenance_ops { |
|---|
| 252 | | - int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *, unsigned); |
|---|
| 253 | | - struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); |
|---|
| 254 | | - int (*renew_lease)(struct nfs_client *, struct rpc_cred *); |
|---|
| 258 | + int (*sched_state_renewal)(struct nfs_client *, const struct cred *, unsigned); |
|---|
| 259 | + const struct cred * (*get_state_renewal_cred)(struct nfs_client *); |
|---|
| 260 | + int (*renew_lease)(struct nfs_client *, const struct cred *); |
|---|
| 255 | 261 | }; |
|---|
| 256 | 262 | |
|---|
| 257 | 263 | struct nfs4_mig_recovery_ops { |
|---|
| 258 | 264 | int (*get_locations)(struct inode *, struct nfs4_fs_locations *, |
|---|
| 259 | | - struct page *, struct rpc_cred *); |
|---|
| 260 | | - int (*fsid_present)(struct inode *, struct rpc_cred *); |
|---|
| 265 | + struct page *, const struct cred *); |
|---|
| 266 | + int (*fsid_present)(struct inode *, const struct cred *); |
|---|
| 261 | 267 | }; |
|---|
| 262 | 268 | |
|---|
| 263 | 269 | extern const struct dentry_operations nfs4_dentry_operations; |
|---|
| .. | .. |
|---|
| 266 | 272 | int nfs_atomic_open(struct inode *, struct dentry *, struct file *, |
|---|
| 267 | 273 | unsigned, umode_t); |
|---|
| 268 | 274 | |
|---|
| 269 | | -/* super.c */ |
|---|
| 275 | +/* fs_context.c */ |
|---|
| 270 | 276 | extern struct file_system_type nfs4_fs_type; |
|---|
| 271 | 277 | |
|---|
| 272 | 278 | /* nfs4namespace.c */ |
|---|
| 273 | 279 | struct rpc_clnt *nfs4_negotiate_security(struct rpc_clnt *, struct inode *, |
|---|
| 274 | 280 | const struct qstr *); |
|---|
| 275 | | -struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, |
|---|
| 276 | | - struct nfs_fh *, struct nfs_fattr *); |
|---|
| 281 | +int nfs4_submount(struct fs_context *, struct nfs_server *); |
|---|
| 277 | 282 | int nfs4_replace_transport(struct nfs_server *server, |
|---|
| 278 | 283 | const struct nfs4_fs_locations *locations); |
|---|
| 279 | 284 | size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa, |
|---|
| 280 | | - size_t salen, struct net *net); |
|---|
| 285 | + size_t salen, struct net *net, int port); |
|---|
| 281 | 286 | /* nfs4proc.c */ |
|---|
| 282 | 287 | extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *); |
|---|
| 283 | 288 | extern int nfs4_async_handle_error(struct rpc_task *task, |
|---|
| .. | .. |
|---|
| 287 | 292 | struct rpc_message *, struct nfs4_sequence_args *, |
|---|
| 288 | 293 | struct nfs4_sequence_res *, int); |
|---|
| 289 | 294 | extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int); |
|---|
| 290 | | -extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); |
|---|
| 291 | | -extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); |
|---|
| 295 | +extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *); |
|---|
| 296 | +extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *); |
|---|
| 292 | 297 | extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *, bool); |
|---|
| 293 | | -extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, struct rpc_cred *cred); |
|---|
| 294 | | -extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); |
|---|
| 298 | +extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, const struct cred *cred); |
|---|
| 299 | +extern int nfs4_proc_exchange_id(struct nfs_client *clp, const struct cred *cred); |
|---|
| 295 | 300 | extern int nfs4_destroy_clientid(struct nfs_client *clp); |
|---|
| 296 | | -extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); |
|---|
| 297 | | -extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); |
|---|
| 301 | +extern int nfs4_init_clientid(struct nfs_client *, const struct cred *); |
|---|
| 302 | +extern int nfs41_init_clientid(struct nfs_client *, const struct cred *); |
|---|
| 298 | 303 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait); |
|---|
| 299 | 304 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); |
|---|
| 300 | 305 | extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *, |
|---|
| 301 | 306 | struct nfs4_fs_locations *, struct page *); |
|---|
| 302 | 307 | extern int nfs4_proc_get_locations(struct inode *, struct nfs4_fs_locations *, |
|---|
| 303 | | - struct page *page, struct rpc_cred *); |
|---|
| 304 | | -extern int nfs4_proc_fsid_present(struct inode *, struct rpc_cred *); |
|---|
| 305 | | -extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, const struct qstr *, |
|---|
| 306 | | - struct nfs_fh *, struct nfs_fattr *); |
|---|
| 308 | + struct page *page, const struct cred *); |
|---|
| 309 | +extern int nfs4_proc_fsid_present(struct inode *, const struct cred *); |
|---|
| 310 | +extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, |
|---|
| 311 | + struct dentry *, |
|---|
| 312 | + struct nfs_fh *, |
|---|
| 313 | + struct nfs_fattr *); |
|---|
| 307 | 314 | extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); |
|---|
| 308 | 315 | extern const struct xattr_handler *nfs4_xattr_handlers[]; |
|---|
| 309 | 316 | extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, |
|---|
| 310 | 317 | const struct nfs_open_context *ctx, |
|---|
| 311 | 318 | const struct nfs_lock_context *l_ctx, |
|---|
| 312 | 319 | fmode_t fmode); |
|---|
| 320 | +extern int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
|---|
| 321 | + struct nfs_fattr *fattr, struct nfs4_label *label, |
|---|
| 322 | + struct inode *inode); |
|---|
| 323 | +extern int update_open_stateid(struct nfs4_state *state, |
|---|
| 324 | + const nfs4_stateid *open_stateid, |
|---|
| 325 | + const nfs4_stateid *deleg_stateid, |
|---|
| 326 | + fmode_t fmode); |
|---|
| 327 | + |
|---|
| 328 | +extern int nfs4_proc_get_lease_time(struct nfs_client *clp, |
|---|
| 329 | + struct nfs_fsinfo *fsinfo); |
|---|
| 330 | +extern void nfs4_update_changeattr(struct inode *dir, |
|---|
| 331 | + struct nfs4_change_info *cinfo, |
|---|
| 332 | + unsigned long timestamp, |
|---|
| 333 | + unsigned long cache_validity); |
|---|
| 334 | +extern int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen, |
|---|
| 335 | + struct page **pages); |
|---|
| 313 | 336 | |
|---|
| 314 | 337 | #if defined(CONFIG_NFS_V4_1) |
|---|
| 315 | 338 | extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *); |
|---|
| 316 | | -extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *); |
|---|
| 317 | | -extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *); |
|---|
| 318 | | -extern int nfs4_proc_get_lease_time(struct nfs_client *clp, |
|---|
| 319 | | - struct nfs_fsinfo *fsinfo); |
|---|
| 339 | +extern int nfs4_proc_create_session(struct nfs_client *, const struct cred *); |
|---|
| 340 | +extern int nfs4_proc_destroy_session(struct nfs4_session *, const struct cred *); |
|---|
| 320 | 341 | extern int nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, |
|---|
| 321 | 342 | bool sync); |
|---|
| 322 | 343 | extern int nfs4_detect_session_trunking(struct nfs_client *clp, |
|---|
| .. | .. |
|---|
| 339 | 360 | _nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_mode, |
|---|
| 340 | 361 | struct rpc_clnt **clntp, struct rpc_message *msg) |
|---|
| 341 | 362 | { |
|---|
| 342 | | - struct rpc_cred *newcred = NULL; |
|---|
| 343 | 363 | rpc_authflavor_t flavor; |
|---|
| 344 | 364 | |
|---|
| 345 | 365 | if (sp4_mode == NFS_SP4_MACH_CRED_CLEANUP || |
|---|
| .. | .. |
|---|
| 354 | 374 | return false; |
|---|
| 355 | 375 | } |
|---|
| 356 | 376 | if (test_bit(sp4_mode, &clp->cl_sp4_flags)) { |
|---|
| 357 | | - spin_lock(&clp->cl_lock); |
|---|
| 358 | | - if (clp->cl_machine_cred != NULL) |
|---|
| 359 | | - /* don't call get_rpccred on the machine cred - |
|---|
| 360 | | - * a reference will be held for life of clp */ |
|---|
| 361 | | - newcred = clp->cl_machine_cred; |
|---|
| 362 | | - spin_unlock(&clp->cl_lock); |
|---|
| 363 | | - msg->rpc_cred = newcred; |
|---|
| 377 | + msg->rpc_cred = rpc_machine_cred(); |
|---|
| 364 | 378 | |
|---|
| 365 | 379 | flavor = clp->cl_rpcclient->cl_auth->au_flavor; |
|---|
| 366 | 380 | WARN_ON_ONCE(flavor != RPC_AUTH_GSS_KRB5I && |
|---|
| .. | .. |
|---|
| 445 | 459 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); |
|---|
| 446 | 460 | extern void nfs4_kill_renewd(struct nfs_client *); |
|---|
| 447 | 461 | extern void nfs4_renew_state(struct work_struct *); |
|---|
| 448 | | -extern void nfs4_set_lease_period(struct nfs_client *clp, |
|---|
| 449 | | - unsigned long lease, |
|---|
| 450 | | - unsigned long lastrenewed); |
|---|
| 462 | +extern void nfs4_set_lease_period(struct nfs_client *clp, unsigned long lease); |
|---|
| 451 | 463 | |
|---|
| 452 | 464 | |
|---|
| 453 | 465 | /* nfs4state.c */ |
|---|
| 454 | | -struct rpc_cred *nfs4_get_clid_cred(struct nfs_client *clp); |
|---|
| 455 | | -struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp); |
|---|
| 456 | | -struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp); |
|---|
| 466 | +extern const nfs4_stateid current_stateid; |
|---|
| 467 | + |
|---|
| 468 | +const struct cred *nfs4_get_clid_cred(struct nfs_client *clp); |
|---|
| 469 | +const struct cred *nfs4_get_machine_cred(struct nfs_client *clp); |
|---|
| 470 | +const struct cred *nfs4_get_renew_cred(struct nfs_client *clp); |
|---|
| 457 | 471 | int nfs4_discover_server_trunking(struct nfs_client *clp, |
|---|
| 458 | 472 | struct nfs_client **); |
|---|
| 459 | 473 | int nfs40_discover_server_trunking(struct nfs_client *clp, |
|---|
| 460 | | - struct nfs_client **, struct rpc_cred *); |
|---|
| 474 | + struct nfs_client **, const struct cred *); |
|---|
| 461 | 475 | #if defined(CONFIG_NFS_V4_1) |
|---|
| 462 | 476 | int nfs41_discover_server_trunking(struct nfs_client *clp, |
|---|
| 463 | | - struct nfs_client **, struct rpc_cred *); |
|---|
| 477 | + struct nfs_client **, const struct cred *); |
|---|
| 464 | 478 | extern void nfs4_schedule_session_recovery(struct nfs4_session *, int); |
|---|
| 465 | 479 | extern void nfs41_notify_server(struct nfs_client *); |
|---|
| 480 | +bool nfs4_check_serverowner_major_id(struct nfs41_server_owner *o1, |
|---|
| 481 | + struct nfs41_server_owner *o2); |
|---|
| 466 | 482 | #else |
|---|
| 467 | 483 | static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err) |
|---|
| 468 | 484 | { |
|---|
| 469 | 485 | } |
|---|
| 470 | 486 | #endif /* CONFIG_NFS_V4_1 */ |
|---|
| 471 | 487 | |
|---|
| 472 | | -extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *, gfp_t); |
|---|
| 488 | +extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, const struct cred *, gfp_t); |
|---|
| 473 | 489 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); |
|---|
| 474 | 490 | extern void nfs4_purge_state_owners(struct nfs_server *, struct list_head *); |
|---|
| 475 | 491 | extern void nfs4_free_state_owners(struct list_head *head); |
|---|
| .. | .. |
|---|
| 496 | 512 | extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); |
|---|
| 497 | 513 | extern int nfs4_select_rw_stateid(struct nfs4_state *, fmode_t, |
|---|
| 498 | 514 | const struct nfs_lock_context *, nfs4_stateid *, |
|---|
| 499 | | - struct rpc_cred **); |
|---|
| 500 | | -extern bool nfs4_refresh_open_stateid(nfs4_stateid *dst, |
|---|
| 501 | | - struct nfs4_state *state); |
|---|
| 515 | + const struct cred **); |
|---|
| 502 | 516 | extern bool nfs4_copy_open_stateid(nfs4_stateid *dst, |
|---|
| 503 | 517 | struct nfs4_state *state); |
|---|
| 504 | 518 | |
|---|
| .. | .. |
|---|
| 523 | 537 | /* nfs4super.c */ |
|---|
| 524 | 538 | struct nfs_mount_info; |
|---|
| 525 | 539 | extern struct nfs_subversion nfs_v4; |
|---|
| 526 | | -struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *); |
|---|
| 527 | 540 | extern bool nfs4_disable_idmapping; |
|---|
| 528 | 541 | extern unsigned short max_session_slots; |
|---|
| 529 | 542 | extern unsigned short max_session_cb_slots; |
|---|
| .. | .. |
|---|
| 532 | 545 | |
|---|
| 533 | 546 | #define NFS4_CLIENT_ID_UNIQ_LEN (64) |
|---|
| 534 | 547 | extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN]; |
|---|
| 548 | + |
|---|
| 549 | +extern int nfs4_try_get_tree(struct fs_context *); |
|---|
| 550 | +extern int nfs4_get_referral_tree(struct fs_context *); |
|---|
| 535 | 551 | |
|---|
| 536 | 552 | /* nfs4sysctl.c */ |
|---|
| 537 | 553 | #ifdef CONFIG_SYSCTL |
|---|
| .. | .. |
|---|
| 550 | 566 | |
|---|
| 551 | 567 | /* nfs4xdr.c */ |
|---|
| 552 | 568 | extern const struct rpc_procinfo nfs4_procedures[]; |
|---|
| 569 | + |
|---|
| 570 | +#ifdef CONFIG_NFS_V4_2 |
|---|
| 571 | +extern const u32 nfs42_maxsetxattr_overhead; |
|---|
| 572 | +extern const u32 nfs42_maxgetxattr_overhead; |
|---|
| 573 | +extern const u32 nfs42_maxlistxattrs_overhead; |
|---|
| 574 | +#endif |
|---|
| 553 | 575 | |
|---|
| 554 | 576 | struct nfs4_mount_data; |
|---|
| 555 | 577 | |
|---|
| .. | .. |
|---|
| 580 | 602 | return (s32)(be32_to_cpu(s1->seqid) - be32_to_cpu(s2->seqid)) > 0; |
|---|
| 581 | 603 | } |
|---|
| 582 | 604 | |
|---|
| 605 | +static inline bool nfs4_stateid_is_next(const nfs4_stateid *s1, const nfs4_stateid *s2) |
|---|
| 606 | +{ |
|---|
| 607 | + u32 seq1 = be32_to_cpu(s1->seqid); |
|---|
| 608 | + u32 seq2 = be32_to_cpu(s2->seqid); |
|---|
| 609 | + |
|---|
| 610 | + return seq2 == seq1 + 1U || (seq2 == 1U && seq1 == 0xffffffffU); |
|---|
| 611 | +} |
|---|
| 612 | + |
|---|
| 613 | +static inline bool nfs4_stateid_match_or_older(const nfs4_stateid *dst, const nfs4_stateid *src) |
|---|
| 614 | +{ |
|---|
| 615 | + return nfs4_stateid_match_other(dst, src) && |
|---|
| 616 | + !(src->seqid && nfs4_stateid_is_newer(dst, src)); |
|---|
| 617 | +} |
|---|
| 618 | + |
|---|
| 619 | +static inline void nfs4_stateid_seqid_inc(nfs4_stateid *s1) |
|---|
| 620 | +{ |
|---|
| 621 | + u32 seqid = be32_to_cpu(s1->seqid); |
|---|
| 622 | + |
|---|
| 623 | + if (++seqid == 0) |
|---|
| 624 | + ++seqid; |
|---|
| 625 | + s1->seqid = cpu_to_be32(seqid); |
|---|
| 626 | +} |
|---|
| 627 | + |
|---|
| 583 | 628 | static inline bool nfs4_valid_open_stateid(const struct nfs4_state *state) |
|---|
| 584 | 629 | { |
|---|
| 585 | 630 | return test_bit(NFS_STATE_RECOVERY_FAILED, &state->flags) == 0; |
|---|
| .. | .. |
|---|
| 592 | 637 | nfs4_stateid_match_other(&state->open_stateid, stateid); |
|---|
| 593 | 638 | } |
|---|
| 594 | 639 | |
|---|
| 640 | +/* nfs42xattr.c */ |
|---|
| 641 | +#ifdef CONFIG_NFS_V4_2 |
|---|
| 642 | +extern int __init nfs4_xattr_cache_init(void); |
|---|
| 643 | +extern void nfs4_xattr_cache_exit(void); |
|---|
| 644 | +extern void nfs4_xattr_cache_add(struct inode *inode, const char *name, |
|---|
| 645 | + const char *buf, struct page **pages, |
|---|
| 646 | + ssize_t buflen); |
|---|
| 647 | +extern void nfs4_xattr_cache_remove(struct inode *inode, const char *name); |
|---|
| 648 | +extern ssize_t nfs4_xattr_cache_get(struct inode *inode, const char *name, |
|---|
| 649 | + char *buf, ssize_t buflen); |
|---|
| 650 | +extern void nfs4_xattr_cache_set_list(struct inode *inode, const char *buf, |
|---|
| 651 | + ssize_t buflen); |
|---|
| 652 | +extern ssize_t nfs4_xattr_cache_list(struct inode *inode, char *buf, |
|---|
| 653 | + ssize_t buflen); |
|---|
| 654 | +extern void nfs4_xattr_cache_zap(struct inode *inode); |
|---|
| 595 | 655 | #else |
|---|
| 656 | +static inline void nfs4_xattr_cache_zap(struct inode *inode) |
|---|
| 657 | +{ |
|---|
| 658 | +} |
|---|
| 659 | +#endif /* CONFIG_NFS_V4_2 */ |
|---|
| 660 | + |
|---|
| 661 | +#else /* CONFIG_NFS_V4 */ |
|---|
| 596 | 662 | |
|---|
| 597 | 663 | #define nfs4_close_state(a, b) do { } while (0) |
|---|
| 598 | 664 | #define nfs4_close_sync(a, b) do { } while (0) |
|---|
| 599 | 665 | #define nfs4_state_protect(a, b, c, d) do { } while (0) |
|---|
| 600 | 666 | #define nfs4_state_protect_write(a, b, c, d) do { } while (0) |
|---|
| 601 | 667 | |
|---|
| 668 | + |
|---|
| 602 | 669 | #endif /* CONFIG_NFS_V4 */ |
|---|
| 603 | 670 | #endif /* __LINUX_FS_NFS_NFS4_FS.H */ |
|---|