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