diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-07 15:57:46 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-07 15:57:46 -0500 |
| commit | c224b76b560f3c65f0d10fbb59d3f00379eb0aaf (patch) | |
| tree | 4af73496d5a8322edc1de196a9b904c8264761a1 /include | |
| parent | a1212d278c05ca0a38f5cbd7ae90ac2e367228a8 (diff) | |
| parent | fab99ebe39fe7d11fbd9b5fb84f07432af9ba36f (diff) | |
Merge tag 'nfs-for-3.13-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust:
"Highlights include:
- Changes to the RPC socket code to allow NFSv4 to turn off
timeout+retry:
* Detect TCP connection breakage through the "keepalive" mechanism
- Add client side support for NFSv4.x migration (Chuck Lever)
- Add support for multiple security flavour arguments to the "sec="
mount option (Dros Adamson)
- fs-cache bugfixes from David Howells:
* Fix an issue whereby caching can be enabled on a file that is
open for writing
- More NFSv4 open code stable bugfixes
- Various Labeled NFS (selinux) bugfixes, including one stable fix
- Fix buffer overflow checking in the RPCSEC_GSS upcall encoding"
* tag 'nfs-for-3.13-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (68 commits)
NFSv4.2: Remove redundant checks in nfs_setsecurity+nfs4_label_init_security
NFSv4: Sanity check the server reply in _nfs4_server_capabilities
NFSv4.2: encode_readdir - only ask for labels when doing readdirplus
nfs: set security label when revalidating inode
NFSv4.2: Fix a mismatch between Linux labeled NFS and the NFSv4.2 spec
NFS: Fix a missing initialisation when reading the SELinux label
nfs: fix oops when trying to set SELinux label
nfs: fix inverted test for delegation in nfs4_reclaim_open_state
SUNRPC: Cleanup xs_destroy()
SUNRPC: close a rare race in xs_tcp_setup_socket.
SUNRPC: remove duplicated include from clnt.c
nfs: use IS_ROOT not DCACHE_DISCONNECTED
SUNRPC: Fix buffer overflow checking in gss_encode_v0_msg/gss_encode_v1_msg
SUNRPC: gss_alloc_msg - choose _either_ a v0 message or a v1 message
SUNRPC: remove an unnecessary if statement
nfs: Use PTR_ERR_OR_ZERO in 'nfs/nfs4super.c'
nfs: Use PTR_ERR_OR_ZERO in 'nfs41_callback_up' function
nfs: Remove useless 'error' assignment
sunrpc: comment typo fix
SUNRPC: Add correct rcu_dereference annotation in rpc_clnt_set_transport
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/fs.h | 5 | ||||
| -rw-r--r-- | include/linux/fscache-cache.h | 50 | ||||
| -rw-r--r-- | include/linux/fscache.h | 113 | ||||
| -rw-r--r-- | include/linux/nfs4.h | 5 | ||||
| -rw-r--r-- | include/linux/nfs_fs.h | 8 | ||||
| -rw-r--r-- | include/linux/nfs_fs_sb.h | 10 | ||||
| -rw-r--r-- | include/linux/nfs_xdr.h | 24 | ||||
| -rw-r--r-- | include/linux/sunrpc/clnt.h | 6 | ||||
| -rw-r--r-- | include/linux/sunrpc/sched.h | 1 | ||||
| -rw-r--r-- | include/linux/sunrpc/xprt.h | 2 | ||||
| -rw-r--r-- | include/uapi/linux/nfs_mount.h | 2 |
11 files changed, 175 insertions, 51 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 3f40547ba191..955dff5da56a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2292,6 +2292,11 @@ static inline void allow_write_access(struct file *file) | |||
| 2292 | if (file) | 2292 | if (file) |
| 2293 | atomic_inc(&file_inode(file)->i_writecount); | 2293 | atomic_inc(&file_inode(file)->i_writecount); |
| 2294 | } | 2294 | } |
| 2295 | static inline bool inode_is_open_for_write(const struct inode *inode) | ||
| 2296 | { | ||
| 2297 | return atomic_read(&inode->i_writecount) > 0; | ||
| 2298 | } | ||
| 2299 | |||
| 2295 | #ifdef CONFIG_IMA | 2300 | #ifdef CONFIG_IMA |
| 2296 | static inline void i_readcount_dec(struct inode *inode) | 2301 | static inline void i_readcount_dec(struct inode *inode) |
| 2297 | { | 2302 | { |
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index 7823e9ef995e..771484993ca7 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h | |||
| @@ -308,36 +308,6 @@ struct fscache_cache_ops { | |||
| 308 | void (*dissociate_pages)(struct fscache_cache *cache); | 308 | void (*dissociate_pages)(struct fscache_cache *cache); |
| 309 | }; | 309 | }; |
| 310 | 310 | ||
| 311 | /* | ||
| 312 | * data file or index object cookie | ||
| 313 | * - a file will only appear in one cache | ||
| 314 | * - a request to cache a file may or may not be honoured, subject to | ||
| 315 | * constraints such as disk space | ||
| 316 | * - indices are created on disk just-in-time | ||
| 317 | */ | ||
| 318 | struct fscache_cookie { | ||
| 319 | atomic_t usage; /* number of users of this cookie */ | ||
| 320 | atomic_t n_children; /* number of children of this cookie */ | ||
| 321 | atomic_t n_active; /* number of active users of netfs ptrs */ | ||
| 322 | spinlock_t lock; | ||
| 323 | spinlock_t stores_lock; /* lock on page store tree */ | ||
| 324 | struct hlist_head backing_objects; /* object(s) backing this file/index */ | ||
| 325 | const struct fscache_cookie_def *def; /* definition */ | ||
| 326 | struct fscache_cookie *parent; /* parent of this entry */ | ||
| 327 | void *netfs_data; /* back pointer to netfs */ | ||
| 328 | struct radix_tree_root stores; /* pages to be stored on this cookie */ | ||
| 329 | #define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */ | ||
| 330 | #define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */ | ||
| 331 | |||
| 332 | unsigned long flags; | ||
| 333 | #define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ | ||
| 334 | #define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */ | ||
| 335 | #define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */ | ||
| 336 | #define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */ | ||
| 337 | #define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */ | ||
| 338 | #define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */ | ||
| 339 | }; | ||
| 340 | |||
| 341 | extern struct fscache_cookie fscache_fsdef_index; | 311 | extern struct fscache_cookie fscache_fsdef_index; |
| 342 | 312 | ||
| 343 | /* | 313 | /* |
| @@ -400,6 +370,7 @@ struct fscache_object { | |||
| 400 | #define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */ | 370 | #define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */ |
| 401 | #define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ | 371 | #define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ |
| 402 | #define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ | 372 | #define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ |
| 373 | #define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */ | ||
| 403 | 374 | ||
| 404 | struct list_head cache_link; /* link in cache->object_list */ | 375 | struct list_head cache_link; /* link in cache->object_list */ |
| 405 | struct hlist_node cookie_link; /* link in cookie->backing_objects */ | 376 | struct hlist_node cookie_link; /* link in cookie->backing_objects */ |
| @@ -511,6 +482,11 @@ static inline void fscache_end_io(struct fscache_retrieval *op, | |||
| 511 | op->end_io_func(page, op->context, error); | 482 | op->end_io_func(page, op->context, error); |
| 512 | } | 483 | } |
| 513 | 484 | ||
| 485 | static inline void __fscache_use_cookie(struct fscache_cookie *cookie) | ||
| 486 | { | ||
| 487 | atomic_inc(&cookie->n_active); | ||
| 488 | } | ||
| 489 | |||
| 514 | /** | 490 | /** |
| 515 | * fscache_use_cookie - Request usage of cookie attached to an object | 491 | * fscache_use_cookie - Request usage of cookie attached to an object |
| 516 | * @object: Object description | 492 | * @object: Object description |
| @@ -524,6 +500,16 @@ static inline bool fscache_use_cookie(struct fscache_object *object) | |||
| 524 | return atomic_inc_not_zero(&cookie->n_active) != 0; | 500 | return atomic_inc_not_zero(&cookie->n_active) != 0; |
| 525 | } | 501 | } |
| 526 | 502 | ||
| 503 | static inline bool __fscache_unuse_cookie(struct fscache_cookie *cookie) | ||
| 504 | { | ||
| 505 | return atomic_dec_and_test(&cookie->n_active); | ||
| 506 | } | ||
| 507 | |||
| 508 | static inline void __fscache_wake_unused_cookie(struct fscache_cookie *cookie) | ||
| 509 | { | ||
| 510 | wake_up_atomic_t(&cookie->n_active); | ||
| 511 | } | ||
| 512 | |||
| 527 | /** | 513 | /** |
| 528 | * fscache_unuse_cookie - Cease usage of cookie attached to an object | 514 | * fscache_unuse_cookie - Cease usage of cookie attached to an object |
| 529 | * @object: Object description | 515 | * @object: Object description |
| @@ -534,8 +520,8 @@ static inline bool fscache_use_cookie(struct fscache_object *object) | |||
| 534 | static inline void fscache_unuse_cookie(struct fscache_object *object) | 520 | static inline void fscache_unuse_cookie(struct fscache_object *object) |
| 535 | { | 521 | { |
| 536 | struct fscache_cookie *cookie = object->cookie; | 522 | struct fscache_cookie *cookie = object->cookie; |
| 537 | if (atomic_dec_and_test(&cookie->n_active)) | 523 | if (__fscache_unuse_cookie(cookie)) |
| 538 | wake_up_atomic_t(&cookie->n_active); | 524 | __fscache_wake_unused_cookie(cookie); |
| 539 | } | 525 | } |
| 540 | 526 | ||
| 541 | /* | 527 | /* |
diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 19b46458e4e8..115bb81912cc 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h | |||
| @@ -167,6 +167,42 @@ struct fscache_netfs { | |||
| 167 | }; | 167 | }; |
| 168 | 168 | ||
| 169 | /* | 169 | /* |
| 170 | * data file or index object cookie | ||
| 171 | * - a file will only appear in one cache | ||
| 172 | * - a request to cache a file may or may not be honoured, subject to | ||
| 173 | * constraints such as disk space | ||
| 174 | * - indices are created on disk just-in-time | ||
| 175 | */ | ||
| 176 | struct fscache_cookie { | ||
| 177 | atomic_t usage; /* number of users of this cookie */ | ||
| 178 | atomic_t n_children; /* number of children of this cookie */ | ||
| 179 | atomic_t n_active; /* number of active users of netfs ptrs */ | ||
| 180 | spinlock_t lock; | ||
| 181 | spinlock_t stores_lock; /* lock on page store tree */ | ||
| 182 | struct hlist_head backing_objects; /* object(s) backing this file/index */ | ||
| 183 | const struct fscache_cookie_def *def; /* definition */ | ||
| 184 | struct fscache_cookie *parent; /* parent of this entry */ | ||
| 185 | void *netfs_data; /* back pointer to netfs */ | ||
| 186 | struct radix_tree_root stores; /* pages to be stored on this cookie */ | ||
| 187 | #define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */ | ||
| 188 | #define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */ | ||
| 189 | |||
| 190 | unsigned long flags; | ||
| 191 | #define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ | ||
| 192 | #define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */ | ||
| 193 | #define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */ | ||
| 194 | #define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */ | ||
| 195 | #define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */ | ||
| 196 | #define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */ | ||
| 197 | #define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */ | ||
| 198 | }; | ||
| 199 | |||
| 200 | static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie) | ||
| 201 | { | ||
| 202 | return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); | ||
| 203 | } | ||
| 204 | |||
| 205 | /* | ||
| 170 | * slow-path functions for when there is actually caching available, and the | 206 | * slow-path functions for when there is actually caching available, and the |
| 171 | * netfs does actually have a valid token | 207 | * netfs does actually have a valid token |
| 172 | * - these are not to be called directly | 208 | * - these are not to be called directly |
| @@ -181,8 +217,8 @@ extern void __fscache_release_cache_tag(struct fscache_cache_tag *); | |||
| 181 | extern struct fscache_cookie *__fscache_acquire_cookie( | 217 | extern struct fscache_cookie *__fscache_acquire_cookie( |
| 182 | struct fscache_cookie *, | 218 | struct fscache_cookie *, |
| 183 | const struct fscache_cookie_def *, | 219 | const struct fscache_cookie_def *, |
| 184 | void *); | 220 | void *, bool); |
| 185 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); | 221 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, bool); |
| 186 | extern int __fscache_check_consistency(struct fscache_cookie *); | 222 | extern int __fscache_check_consistency(struct fscache_cookie *); |
| 187 | extern void __fscache_update_cookie(struct fscache_cookie *); | 223 | extern void __fscache_update_cookie(struct fscache_cookie *); |
| 188 | extern int __fscache_attr_changed(struct fscache_cookie *); | 224 | extern int __fscache_attr_changed(struct fscache_cookie *); |
| @@ -211,6 +247,9 @@ extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *, | |||
| 211 | struct inode *); | 247 | struct inode *); |
| 212 | extern void __fscache_readpages_cancel(struct fscache_cookie *cookie, | 248 | extern void __fscache_readpages_cancel(struct fscache_cookie *cookie, |
| 213 | struct list_head *pages); | 249 | struct list_head *pages); |
| 250 | extern void __fscache_disable_cookie(struct fscache_cookie *, bool); | ||
| 251 | extern void __fscache_enable_cookie(struct fscache_cookie *, | ||
| 252 | bool (*)(void *), void *); | ||
| 214 | 253 | ||
| 215 | /** | 254 | /** |
| 216 | * fscache_register_netfs - Register a filesystem as desiring caching services | 255 | * fscache_register_netfs - Register a filesystem as desiring caching services |
| @@ -289,6 +328,7 @@ void fscache_release_cache_tag(struct fscache_cache_tag *tag) | |||
| 289 | * @def: A description of the cache object, including callback operations | 328 | * @def: A description of the cache object, including callback operations |
| 290 | * @netfs_data: An arbitrary piece of data to be kept in the cookie to | 329 | * @netfs_data: An arbitrary piece of data to be kept in the cookie to |
| 291 | * represent the cache object to the netfs | 330 | * represent the cache object to the netfs |
| 331 | * @enable: Whether or not to enable a data cookie immediately | ||
| 292 | * | 332 | * |
| 293 | * This function is used to inform FS-Cache about part of an index hierarchy | 333 | * This function is used to inform FS-Cache about part of an index hierarchy |
| 294 | * that can be used to locate files. This is done by requesting a cookie for | 334 | * that can be used to locate files. This is done by requesting a cookie for |
| @@ -301,10 +341,12 @@ static inline | |||
| 301 | struct fscache_cookie *fscache_acquire_cookie( | 341 | struct fscache_cookie *fscache_acquire_cookie( |
| 302 | struct fscache_cookie *parent, | 342 | struct fscache_cookie *parent, |
| 303 | const struct fscache_cookie_def *def, | 343 | const struct fscache_cookie_def *def, |
| 304 | void *netfs_data) | 344 | void *netfs_data, |
| 345 | bool enable) | ||
| 305 | { | 346 | { |
| 306 | if (fscache_cookie_valid(parent)) | 347 | if (fscache_cookie_valid(parent) && fscache_cookie_enabled(parent)) |
| 307 | return __fscache_acquire_cookie(parent, def, netfs_data); | 348 | return __fscache_acquire_cookie(parent, def, netfs_data, |
| 349 | enable); | ||
| 308 | else | 350 | else |
| 309 | return NULL; | 351 | return NULL; |
| 310 | } | 352 | } |
| @@ -322,7 +364,7 @@ struct fscache_cookie *fscache_acquire_cookie( | |||
| 322 | * description. | 364 | * description. |
| 323 | */ | 365 | */ |
| 324 | static inline | 366 | static inline |
| 325 | void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) | 367 | void fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire) |
| 326 | { | 368 | { |
| 327 | if (fscache_cookie_valid(cookie)) | 369 | if (fscache_cookie_valid(cookie)) |
| 328 | __fscache_relinquish_cookie(cookie, retire); | 370 | __fscache_relinquish_cookie(cookie, retire); |
| @@ -341,7 +383,7 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) | |||
| 341 | static inline | 383 | static inline |
| 342 | int fscache_check_consistency(struct fscache_cookie *cookie) | 384 | int fscache_check_consistency(struct fscache_cookie *cookie) |
| 343 | { | 385 | { |
| 344 | if (fscache_cookie_valid(cookie)) | 386 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 345 | return __fscache_check_consistency(cookie); | 387 | return __fscache_check_consistency(cookie); |
| 346 | else | 388 | else |
| 347 | return 0; | 389 | return 0; |
| @@ -360,7 +402,7 @@ int fscache_check_consistency(struct fscache_cookie *cookie) | |||
| 360 | static inline | 402 | static inline |
| 361 | void fscache_update_cookie(struct fscache_cookie *cookie) | 403 | void fscache_update_cookie(struct fscache_cookie *cookie) |
| 362 | { | 404 | { |
| 363 | if (fscache_cookie_valid(cookie)) | 405 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 364 | __fscache_update_cookie(cookie); | 406 | __fscache_update_cookie(cookie); |
| 365 | } | 407 | } |
| 366 | 408 | ||
| @@ -407,7 +449,7 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie) | |||
| 407 | static inline | 449 | static inline |
| 408 | int fscache_attr_changed(struct fscache_cookie *cookie) | 450 | int fscache_attr_changed(struct fscache_cookie *cookie) |
| 409 | { | 451 | { |
| 410 | if (fscache_cookie_valid(cookie)) | 452 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 411 | return __fscache_attr_changed(cookie); | 453 | return __fscache_attr_changed(cookie); |
| 412 | else | 454 | else |
| 413 | return -ENOBUFS; | 455 | return -ENOBUFS; |
| @@ -429,7 +471,7 @@ int fscache_attr_changed(struct fscache_cookie *cookie) | |||
| 429 | static inline | 471 | static inline |
| 430 | void fscache_invalidate(struct fscache_cookie *cookie) | 472 | void fscache_invalidate(struct fscache_cookie *cookie) |
| 431 | { | 473 | { |
| 432 | if (fscache_cookie_valid(cookie)) | 474 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 433 | __fscache_invalidate(cookie); | 475 | __fscache_invalidate(cookie); |
| 434 | } | 476 | } |
| 435 | 477 | ||
| @@ -503,7 +545,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie, | |||
| 503 | void *context, | 545 | void *context, |
| 504 | gfp_t gfp) | 546 | gfp_t gfp) |
| 505 | { | 547 | { |
| 506 | if (fscache_cookie_valid(cookie)) | 548 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 507 | return __fscache_read_or_alloc_page(cookie, page, end_io_func, | 549 | return __fscache_read_or_alloc_page(cookie, page, end_io_func, |
| 508 | context, gfp); | 550 | context, gfp); |
| 509 | else | 551 | else |
| @@ -554,7 +596,7 @@ int fscache_read_or_alloc_pages(struct fscache_cookie *cookie, | |||
| 554 | void *context, | 596 | void *context, |
| 555 | gfp_t gfp) | 597 | gfp_t gfp) |
| 556 | { | 598 | { |
| 557 | if (fscache_cookie_valid(cookie)) | 599 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 558 | return __fscache_read_or_alloc_pages(cookie, mapping, pages, | 600 | return __fscache_read_or_alloc_pages(cookie, mapping, pages, |
| 559 | nr_pages, end_io_func, | 601 | nr_pages, end_io_func, |
| 560 | context, gfp); | 602 | context, gfp); |
| @@ -585,7 +627,7 @@ int fscache_alloc_page(struct fscache_cookie *cookie, | |||
| 585 | struct page *page, | 627 | struct page *page, |
| 586 | gfp_t gfp) | 628 | gfp_t gfp) |
| 587 | { | 629 | { |
| 588 | if (fscache_cookie_valid(cookie)) | 630 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 589 | return __fscache_alloc_page(cookie, page, gfp); | 631 | return __fscache_alloc_page(cookie, page, gfp); |
| 590 | else | 632 | else |
| 591 | return -ENOBUFS; | 633 | return -ENOBUFS; |
| @@ -634,7 +676,7 @@ int fscache_write_page(struct fscache_cookie *cookie, | |||
| 634 | struct page *page, | 676 | struct page *page, |
| 635 | gfp_t gfp) | 677 | gfp_t gfp) |
| 636 | { | 678 | { |
| 637 | if (fscache_cookie_valid(cookie)) | 679 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) |
| 638 | return __fscache_write_page(cookie, page, gfp); | 680 | return __fscache_write_page(cookie, page, gfp); |
| 639 | else | 681 | else |
| 640 | return -ENOBUFS; | 682 | return -ENOBUFS; |
| @@ -744,4 +786,47 @@ void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie, | |||
| 744 | __fscache_uncache_all_inode_pages(cookie, inode); | 786 | __fscache_uncache_all_inode_pages(cookie, inode); |
| 745 | } | 787 | } |
| 746 | 788 | ||
| 789 | /** | ||
| 790 | * fscache_disable_cookie - Disable a cookie | ||
| 791 | * @cookie: The cookie representing the cache object | ||
| 792 | * @invalidate: Invalidate the backing object | ||
| 793 | * | ||
| 794 | * Disable a cookie from accepting further alloc, read, write, invalidate, | ||
| 795 | * update or acquire operations. Outstanding operations can still be waited | ||
| 796 | * upon and pages can still be uncached and the cookie relinquished. | ||
| 797 | * | ||
| 798 | * This will not return until all outstanding operations have completed. | ||
| 799 | * | ||
| 800 | * If @invalidate is set, then the backing object will be invalidated and | ||
| 801 | * detached, otherwise it will just be detached. | ||
| 802 | */ | ||
| 803 | static inline | ||
| 804 | void fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) | ||
| 805 | { | ||
| 806 | if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie)) | ||
| 807 | __fscache_disable_cookie(cookie, invalidate); | ||
| 808 | } | ||
| 809 | |||
| 810 | /** | ||
| 811 | * fscache_enable_cookie - Reenable a cookie | ||
| 812 | * @cookie: The cookie representing the cache object | ||
| 813 | * @can_enable: A function to permit enablement once lock is held | ||
| 814 | * @data: Data for can_enable() | ||
| 815 | * | ||
| 816 | * Reenable a previously disabled cookie, allowing it to accept further alloc, | ||
| 817 | * read, write, invalidate, update or acquire operations. An attempt will be | ||
| 818 | * made to immediately reattach the cookie to a backing object. | ||
| 819 | * | ||
| 820 | * The can_enable() function is called (if not NULL) once the enablement lock | ||
| 821 | * is held to rule on whether enablement is still permitted to go ahead. | ||
| 822 | */ | ||
| 823 | static inline | ||
| 824 | void fscache_enable_cookie(struct fscache_cookie *cookie, | ||
| 825 | bool (*can_enable)(void *data), | ||
| 826 | void *data) | ||
| 827 | { | ||
| 828 | if (fscache_cookie_valid(cookie) && !fscache_cookie_enabled(cookie)) | ||
| 829 | __fscache_enable_cookie(cookie, can_enable, data); | ||
| 830 | } | ||
| 831 | |||
| 747 | #endif /* _LINUX_FSCACHE_H */ | 832 | #endif /* _LINUX_FSCACHE_H */ |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index e36dee52f224..c6f41b616965 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -395,7 +395,9 @@ enum lock_type4 { | |||
| 395 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) | 395 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) |
| 396 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) | 396 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) |
| 397 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) | 397 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) |
| 398 | #define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) | 398 | #define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) |
| 399 | #define FATTR4_WORD2_CHANGE_SECURITY_LABEL \ | ||
| 400 | (1UL << 17) | ||
| 399 | 401 | ||
| 400 | /* MDS threshold bitmap bits */ | 402 | /* MDS threshold bitmap bits */ |
| 401 | #define THRESHOLD_RD (1UL << 0) | 403 | #define THRESHOLD_RD (1UL << 0) |
| @@ -460,6 +462,7 @@ enum { | |||
| 460 | NFSPROC4_CLNT_FS_LOCATIONS, | 462 | NFSPROC4_CLNT_FS_LOCATIONS, |
| 461 | NFSPROC4_CLNT_RELEASE_LOCKOWNER, | 463 | NFSPROC4_CLNT_RELEASE_LOCKOWNER, |
| 462 | NFSPROC4_CLNT_SECINFO, | 464 | NFSPROC4_CLNT_SECINFO, |
| 465 | NFSPROC4_CLNT_FSID_PRESENT, | ||
| 463 | 466 | ||
| 464 | /* nfs41 */ | 467 | /* nfs41 */ |
| 465 | NFSPROC4_CLNT_EXCHANGE_ID, | 468 | NFSPROC4_CLNT_EXCHANGE_ID, |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 3ea4cde8701c..14a48207a304 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -269,9 +269,13 @@ static inline int NFS_STALE(const struct inode *inode) | |||
| 269 | return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); | 269 | return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | static inline int NFS_FSCACHE(const struct inode *inode) | 272 | static inline struct fscache_cookie *nfs_i_fscache(struct inode *inode) |
| 273 | { | 273 | { |
| 274 | return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); | 274 | #ifdef CONFIG_NFS_FSCACHE |
| 275 | return NFS_I(inode)->fscache; | ||
| 276 | #else | ||
| 277 | return NULL; | ||
| 278 | #endif | ||
| 275 | } | 279 | } |
| 276 | 280 | ||
| 277 | static inline __u64 NFS_FILEID(const struct inode *inode) | 281 | static inline __u64 NFS_FILEID(const struct inode *inode) |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index b8cedced50c9..1150ea41b626 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
| @@ -41,6 +41,7 @@ struct nfs_client { | |||
| 41 | #define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ | 41 | #define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ |
| 42 | #define NFS_CS_MIGRATION 2 /* - transparent state migr */ | 42 | #define NFS_CS_MIGRATION 2 /* - transparent state migr */ |
| 43 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ | 43 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ |
| 44 | #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ | ||
| 44 | struct sockaddr_storage cl_addr; /* server identifier */ | 45 | struct sockaddr_storage cl_addr; /* server identifier */ |
| 45 | size_t cl_addrlen; | 46 | size_t cl_addrlen; |
| 46 | char * cl_hostname; /* hostname of server */ | 47 | char * cl_hostname; /* hostname of server */ |
| @@ -78,6 +79,7 @@ struct nfs_client { | |||
| 78 | char cl_ipaddr[48]; | 79 | char cl_ipaddr[48]; |
| 79 | u32 cl_cb_ident; /* v4.0 callback identifier */ | 80 | u32 cl_cb_ident; /* v4.0 callback identifier */ |
| 80 | const struct nfs4_minor_version_ops *cl_mvops; | 81 | const struct nfs4_minor_version_ops *cl_mvops; |
| 82 | unsigned long cl_mig_gen; | ||
| 81 | 83 | ||
| 82 | /* NFSv4.0 transport blocking */ | 84 | /* NFSv4.0 transport blocking */ |
| 83 | struct nfs4_slot_table *cl_slot_tbl; | 85 | struct nfs4_slot_table *cl_slot_tbl; |
| @@ -147,7 +149,9 @@ struct nfs_server { | |||
| 147 | __u64 maxfilesize; /* maximum file size */ | 149 | __u64 maxfilesize; /* maximum file size */ |
| 148 | struct timespec time_delta; /* smallest time granularity */ | 150 | struct timespec time_delta; /* smallest time granularity */ |
| 149 | unsigned long mount_time; /* when this fs was mounted */ | 151 | unsigned long mount_time; /* when this fs was mounted */ |
| 152 | struct super_block *super; /* VFS super block */ | ||
| 150 | dev_t s_dev; /* superblock dev numbers */ | 153 | dev_t s_dev; /* superblock dev numbers */ |
| 154 | struct nfs_auth_info auth_info; /* parsed auth flavors */ | ||
| 151 | 155 | ||
| 152 | #ifdef CONFIG_NFS_FSCACHE | 156 | #ifdef CONFIG_NFS_FSCACHE |
| 153 | struct nfs_fscache_key *fscache_key; /* unique key for superblock */ | 157 | struct nfs_fscache_key *fscache_key; /* unique key for superblock */ |
| @@ -187,6 +191,12 @@ struct nfs_server { | |||
| 187 | struct list_head state_owners_lru; | 191 | struct list_head state_owners_lru; |
| 188 | struct list_head layouts; | 192 | struct list_head layouts; |
| 189 | struct list_head delegations; | 193 | struct list_head delegations; |
| 194 | |||
| 195 | unsigned long mig_gen; | ||
| 196 | unsigned long mig_status; | ||
| 197 | #define NFS_MIG_IN_TRANSITION (1) | ||
| 198 | #define NFS_MIG_FAILED (2) | ||
| 199 | |||
| 190 | void (*destroy)(struct nfs_server *); | 200 | void (*destroy)(struct nfs_server *); |
| 191 | 201 | ||
| 192 | atomic_t active; /* Keep trace of any activity to this server */ | 202 | atomic_t active; /* Keep trace of any activity to this server */ |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 49f52c8f4422..3ccfcecf8999 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -591,6 +591,13 @@ struct nfs_renameres { | |||
| 591 | struct nfs_fattr *new_fattr; | 591 | struct nfs_fattr *new_fattr; |
| 592 | }; | 592 | }; |
| 593 | 593 | ||
| 594 | /* parsed sec= options */ | ||
| 595 | #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */ | ||
| 596 | struct nfs_auth_info { | ||
| 597 | unsigned int flavor_len; | ||
| 598 | rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS]; | ||
| 599 | }; | ||
| 600 | |||
| 594 | /* | 601 | /* |
| 595 | * Argument struct for decode_entry function | 602 | * Argument struct for decode_entry function |
| 596 | */ | 603 | */ |
| @@ -1053,14 +1060,18 @@ struct nfs4_fs_locations { | |||
| 1053 | struct nfs4_fs_locations_arg { | 1060 | struct nfs4_fs_locations_arg { |
| 1054 | struct nfs4_sequence_args seq_args; | 1061 | struct nfs4_sequence_args seq_args; |
| 1055 | const struct nfs_fh *dir_fh; | 1062 | const struct nfs_fh *dir_fh; |
| 1063 | const struct nfs_fh *fh; | ||
| 1056 | const struct qstr *name; | 1064 | const struct qstr *name; |
| 1057 | struct page *page; | 1065 | struct page *page; |
| 1058 | const u32 *bitmask; | 1066 | const u32 *bitmask; |
| 1067 | clientid4 clientid; | ||
| 1068 | unsigned char migration:1, renew:1; | ||
| 1059 | }; | 1069 | }; |
| 1060 | 1070 | ||
| 1061 | struct nfs4_fs_locations_res { | 1071 | struct nfs4_fs_locations_res { |
| 1062 | struct nfs4_sequence_res seq_res; | 1072 | struct nfs4_sequence_res seq_res; |
| 1063 | struct nfs4_fs_locations *fs_locations; | 1073 | struct nfs4_fs_locations *fs_locations; |
| 1074 | unsigned char migration:1, renew:1; | ||
| 1064 | }; | 1075 | }; |
| 1065 | 1076 | ||
| 1066 | struct nfs4_secinfo4 { | 1077 | struct nfs4_secinfo4 { |
| @@ -1084,6 +1095,19 @@ struct nfs4_secinfo_res { | |||
| 1084 | struct nfs4_secinfo_flavors *flavors; | 1095 | struct nfs4_secinfo_flavors *flavors; |
| 1085 | }; | 1096 | }; |
| 1086 | 1097 | ||
| 1098 | struct nfs4_fsid_present_arg { | ||
| 1099 | struct nfs4_sequence_args seq_args; | ||
| 1100 | const struct nfs_fh *fh; | ||
| 1101 | clientid4 clientid; | ||
| 1102 | unsigned char renew:1; | ||
| 1103 | }; | ||
| 1104 | |||
| 1105 | struct nfs4_fsid_present_res { | ||
| 1106 | struct nfs4_sequence_res seq_res; | ||
| 1107 | struct nfs_fh *fh; | ||
| 1108 | unsigned char renew:1; | ||
| 1109 | }; | ||
| 1110 | |||
| 1087 | #endif /* CONFIG_NFS_V4 */ | 1111 | #endif /* CONFIG_NFS_V4 */ |
| 1088 | 1112 | ||
| 1089 | struct nfstime4 { | 1113 | struct nfstime4 { |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 6740801aa71a..8af2804bab16 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
| @@ -49,6 +49,7 @@ struct rpc_clnt { | |||
| 49 | 49 | ||
| 50 | unsigned int cl_softrtry : 1,/* soft timeouts */ | 50 | unsigned int cl_softrtry : 1,/* soft timeouts */ |
| 51 | cl_discrtry : 1,/* disconnect before retry */ | 51 | cl_discrtry : 1,/* disconnect before retry */ |
| 52 | cl_noretranstimeo: 1,/* No retransmit timeouts */ | ||
| 52 | cl_autobind : 1,/* use getport() */ | 53 | cl_autobind : 1,/* use getport() */ |
| 53 | cl_chatty : 1;/* be verbose */ | 54 | cl_chatty : 1;/* be verbose */ |
| 54 | 55 | ||
| @@ -126,6 +127,7 @@ struct rpc_create_args { | |||
| 126 | #define RPC_CLNT_CREATE_QUIET (1UL << 6) | 127 | #define RPC_CLNT_CREATE_QUIET (1UL << 6) |
| 127 | #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) | 128 | #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) |
| 128 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) | 129 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) |
| 130 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) | ||
| 129 | 131 | ||
| 130 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 132 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 131 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 133 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
| @@ -134,6 +136,10 @@ void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); | |||
| 134 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 136 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
| 135 | struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, | 137 | struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, |
| 136 | rpc_authflavor_t); | 138 | rpc_authflavor_t); |
| 139 | int rpc_switch_client_transport(struct rpc_clnt *, | ||
| 140 | struct xprt_create *, | ||
| 141 | const struct rpc_timeout *); | ||
| 142 | |||
| 137 | void rpc_shutdown_client(struct rpc_clnt *); | 143 | void rpc_shutdown_client(struct rpc_clnt *); |
| 138 | void rpc_release_client(struct rpc_clnt *); | 144 | void rpc_release_client(struct rpc_clnt *); |
| 139 | void rpc_task_release_client(struct rpc_task *); | 145 | void rpc_task_release_client(struct rpc_task *); |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 096ee58be11a..3a847de83fab 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -122,6 +122,7 @@ struct rpc_task_setup { | |||
| 122 | #define RPC_TASK_SENT 0x0800 /* message was sent */ | 122 | #define RPC_TASK_SENT 0x0800 /* message was sent */ |
| 123 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ | 123 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ |
| 124 | #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ | 124 | #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ |
| 125 | #define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */ | ||
| 125 | 126 | ||
| 126 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 127 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
| 127 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 128 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index cec7b9b5e1bf..8097b9df6773 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -288,7 +288,7 @@ int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); | |||
| 288 | int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); | 288 | int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); |
| 289 | void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); | 289 | void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); |
| 290 | void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); | 290 | void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); |
| 291 | int xprt_prepare_transmit(struct rpc_task *task); | 291 | bool xprt_prepare_transmit(struct rpc_task *task); |
| 292 | void xprt_transmit(struct rpc_task *task); | 292 | void xprt_transmit(struct rpc_task *task); |
| 293 | void xprt_end_transmit(struct rpc_task *task); | 293 | void xprt_end_transmit(struct rpc_task *task); |
| 294 | int xprt_adjust_timeout(struct rpc_rqst *req); | 294 | int xprt_adjust_timeout(struct rpc_rqst *req); |
diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h index 576bddd72e04..64b0f22f5c4c 100644 --- a/include/uapi/linux/nfs_mount.h +++ b/include/uapi/linux/nfs_mount.h | |||
| @@ -60,7 +60,7 @@ struct nfs_mount_data { | |||
| 60 | #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ | 60 | #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ |
| 61 | #define NFS_MOUNT_NOACL 0x0800 /* 4 */ | 61 | #define NFS_MOUNT_NOACL 0x0800 /* 4 */ |
| 62 | #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ | 62 | #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ |
| 63 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ | 63 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */ |
| 64 | #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ | 64 | #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ |
| 65 | #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ | 65 | #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ |
| 66 | #define NFS_MOUNT_FLAGMASK 0xFFFF | 66 | #define NFS_MOUNT_FLAGMASK 0xFFFF |
