aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 22:36:06 -0400
commit1dc51b8288007753ad7cd7d08bb8fa930fc8bb10 (patch)
tree0616c0ff7d877e64d9c248a6cdff074eae258840 /include/linux
parent9b284cbdb5de3b8871014f8290d1b540e5181c21 (diff)
parent0f1db7dee200127da4c07928189748918c312031 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: "Assorted VFS fixes and related cleanups (IMO the most interesting in that part are f_path-related things and Eric's descriptor-related stuff). UFS regression fixes (it got broken last cycle). 9P fixes. fs-cache series, DAX patches, Jan's file_remove_suid() work" [ I'd say this is much more than "fixes and related cleanups". The file_table locking rule change by Eric Dumazet is a rather big and fundamental update even if the patch isn't huge. - Linus ] * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits) 9p: cope with bogus responses from server in p9_client_{read,write} p9_client_write(): avoid double p9_free_req() 9p: forgetting to cancel request on interrupted zero-copy RPC dax: bdev_direct_access() may sleep block: Add support for DAX reads/writes to block devices dax: Use copy_from_iter_nocache dax: Add block size note to documentation fs/file.c: __fget() and dup2() atomicity rules fs/file.c: don't acquire files->file_lock in fd_install() fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation vfs: avoid creation of inode number 0 in get_next_ino namei: make set_root_rcu() return void make simple_positive() public ufs: use dir_pages instead of ufs_dir_pages() pagemap.h: move dir_pages() over there remove the pointless include of lglock.h fs: cleanup slight list_entry abuse xfs: Correctly lock inode when removing suid and file capabilities fs: Call security_ops->inode_killpriv on truncate fs: Provide function telling whether file_remove_privs() will do anything ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dcache.h7
-rw-r--r--include/linux/fdtable.h3
-rw-r--r--include/linux/fs.h11
-rw-r--r--include/linux/fscache-cache.h55
-rw-r--r--include/linux/pagemap.h6
-rw-r--r--include/linux/seq_file.h1
6 files changed, 52 insertions, 31 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index df334cbacc6d..d2d50249b7b2 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -160,6 +160,7 @@ struct dentry_operations {
160 char *(*d_dname)(struct dentry *, char *, int); 160 char *(*d_dname)(struct dentry *, char *, int);
161 struct vfsmount *(*d_automount)(struct path *); 161 struct vfsmount *(*d_automount)(struct path *);
162 int (*d_manage)(struct dentry *, bool); 162 int (*d_manage)(struct dentry *, bool);
163 struct inode *(*d_select_inode)(struct dentry *, unsigned);
163} ____cacheline_aligned; 164} ____cacheline_aligned;
164 165
165/* 166/*
@@ -225,6 +226,7 @@ struct dentry_operations {
225 226
226#define DCACHE_MAY_FREE 0x00800000 227#define DCACHE_MAY_FREE 0x00800000
227#define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ 228#define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */
229#define DCACHE_OP_SELECT_INODE 0x02000000 /* Unioned entry: dcache op selects inode */
228 230
229extern seqlock_t rename_lock; 231extern seqlock_t rename_lock;
230 232
@@ -505,6 +507,11 @@ static inline bool d_really_is_positive(const struct dentry *dentry)
505 return dentry->d_inode != NULL; 507 return dentry->d_inode != NULL;
506} 508}
507 509
510static inline int simple_positive(struct dentry *dentry)
511{
512 return d_really_is_positive(dentry) && !d_unhashed(dentry);
513}
514
508extern void d_set_fallthru(struct dentry *dentry); 515extern void d_set_fallthru(struct dentry *dentry);
509 516
510static inline bool d_is_fallthru(const struct dentry *dentry) 517static inline bool d_is_fallthru(const struct dentry *dentry)
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 230f87bdf5ad..fbb88740634a 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -47,6 +47,9 @@ struct files_struct {
47 * read mostly part 47 * read mostly part
48 */ 48 */
49 atomic_t count; 49 atomic_t count;
50 bool resize_in_progress;
51 wait_queue_head_t resize_wait;
52
50 struct fdtable __rcu *fdt; 53 struct fdtable __rcu *fdt;
51 struct fdtable fdtab; 54 struct fdtable fdtab;
52 /* 55 /*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8a81fcbb0074..a0653e560c26 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1654,7 +1654,6 @@ struct inode_operations {
1654 int (*set_acl)(struct inode *, struct posix_acl *, int); 1654 int (*set_acl)(struct inode *, struct posix_acl *, int);
1655 1655
1656 /* WARNING: probably going away soon, do not use! */ 1656 /* WARNING: probably going away soon, do not use! */
1657 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
1658} ____cacheline_aligned; 1657} ____cacheline_aligned;
1659 1658
1660ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1659ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -2213,7 +2212,6 @@ extern struct file *file_open_name(struct filename *, int, umode_t);
2213extern struct file *filp_open(const char *, int, umode_t); 2212extern struct file *filp_open(const char *, int, umode_t);
2214extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2213extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2215 const char *, int); 2214 const char *, int);
2216extern int vfs_open(const struct path *, struct file *, const struct cred *);
2217extern struct file * dentry_open(const struct path *, int, const struct cred *); 2215extern struct file * dentry_open(const struct path *, int, const struct cred *);
2218extern int filp_close(struct file *, fl_owner_t id); 2216extern int filp_close(struct file *, fl_owner_t id);
2219 2217
@@ -2530,6 +2528,8 @@ extern struct file * open_exec(const char *);
2530extern int is_subdir(struct dentry *, struct dentry *); 2528extern int is_subdir(struct dentry *, struct dentry *);
2531extern int path_is_under(struct path *, struct path *); 2529extern int path_is_under(struct path *, struct path *);
2532 2530
2531extern char *file_path(struct file *, char *, int);
2532
2533#include <linux/err.h> 2533#include <linux/err.h>
2534 2534
2535/* needed for stackable file system support */ 2535/* needed for stackable file system support */
@@ -2581,7 +2581,12 @@ extern struct inode *new_inode_pseudo(struct super_block *sb);
2581extern struct inode *new_inode(struct super_block *sb); 2581extern struct inode *new_inode(struct super_block *sb);
2582extern void free_inode_nonrcu(struct inode *inode); 2582extern void free_inode_nonrcu(struct inode *inode);
2583extern int should_remove_suid(struct dentry *); 2583extern int should_remove_suid(struct dentry *);
2584extern int file_remove_suid(struct file *); 2584extern int file_remove_privs(struct file *);
2585extern int dentry_needs_remove_privs(struct dentry *dentry);
2586static inline int file_needs_remove_privs(struct file *file)
2587{
2588 return dentry_needs_remove_privs(file->f_path.dentry);
2589}
2585 2590
2586extern void __insert_inode_hash(struct inode *, unsigned long hashval); 2591extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2587static inline void insert_inode_hash(struct inode *inode) 2592static inline void insert_inode_hash(struct inode *inode)
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 771484993ca7..604e1526cd00 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -74,6 +74,7 @@ extern wait_queue_head_t fscache_cache_cleared_wq;
74 */ 74 */
75typedef void (*fscache_operation_release_t)(struct fscache_operation *op); 75typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); 76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77typedef void (*fscache_operation_cancel_t)(struct fscache_operation *op);
77 78
78enum fscache_operation_state { 79enum fscache_operation_state {
79 FSCACHE_OP_ST_BLANK, /* Op is not yet submitted */ 80 FSCACHE_OP_ST_BLANK, /* Op is not yet submitted */
@@ -109,6 +110,9 @@ struct fscache_operation {
109 * the op in a non-pool thread */ 110 * the op in a non-pool thread */
110 fscache_operation_processor_t processor; 111 fscache_operation_processor_t processor;
111 112
113 /* Operation cancellation cleanup (optional) */
114 fscache_operation_cancel_t cancel;
115
112 /* operation releaser */ 116 /* operation releaser */
113 fscache_operation_release_t release; 117 fscache_operation_release_t release;
114}; 118};
@@ -119,33 +123,17 @@ extern void fscache_op_work_func(struct work_struct *work);
119extern void fscache_enqueue_operation(struct fscache_operation *); 123extern void fscache_enqueue_operation(struct fscache_operation *);
120extern void fscache_op_complete(struct fscache_operation *, bool); 124extern void fscache_op_complete(struct fscache_operation *, bool);
121extern void fscache_put_operation(struct fscache_operation *); 125extern void fscache_put_operation(struct fscache_operation *);
122 126extern void fscache_operation_init(struct fscache_operation *,
123/** 127 fscache_operation_processor_t,
124 * fscache_operation_init - Do basic initialisation of an operation 128 fscache_operation_cancel_t,
125 * @op: The operation to initialise 129 fscache_operation_release_t);
126 * @release: The release function to assign
127 *
128 * Do basic initialisation of an operation. The caller must still set flags,
129 * object and processor if needed.
130 */
131static inline void fscache_operation_init(struct fscache_operation *op,
132 fscache_operation_processor_t processor,
133 fscache_operation_release_t release)
134{
135 INIT_WORK(&op->work, fscache_op_work_func);
136 atomic_set(&op->usage, 1);
137 op->state = FSCACHE_OP_ST_INITIALISED;
138 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
139 op->processor = processor;
140 op->release = release;
141 INIT_LIST_HEAD(&op->pend_link);
142}
143 130
144/* 131/*
145 * data read operation 132 * data read operation
146 */ 133 */
147struct fscache_retrieval { 134struct fscache_retrieval {
148 struct fscache_operation op; 135 struct fscache_operation op;
136 struct fscache_cookie *cookie; /* The netfs cookie */
149 struct address_space *mapping; /* netfs pages */ 137 struct address_space *mapping; /* netfs pages */
150 fscache_rw_complete_t end_io_func; /* function to call on I/O completion */ 138 fscache_rw_complete_t end_io_func; /* function to call on I/O completion */
151 void *context; /* netfs read context (pinned) */ 139 void *context; /* netfs read context (pinned) */
@@ -371,6 +359,7 @@ struct fscache_object {
371#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ 359#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
372#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ 360#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 */ 361#define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */
362#define FSCACHE_OBJECT_KILLED_BY_CACHE 7 /* T if object was killed by the cache */
374 363
375 struct list_head cache_link; /* link in cache->object_list */ 364 struct list_head cache_link; /* link in cache->object_list */
376 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 365 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -410,17 +399,16 @@ static inline bool fscache_object_is_available(struct fscache_object *object)
410 return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags); 399 return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags);
411} 400}
412 401
413static inline bool fscache_object_is_active(struct fscache_object *object) 402static inline bool fscache_cache_is_broken(struct fscache_object *object)
414{ 403{
415 return fscache_object_is_available(object) && 404 return test_bit(FSCACHE_IOERROR, &object->cache->flags);
416 fscache_object_is_live(object) &&
417 !test_bit(FSCACHE_IOERROR, &object->cache->flags);
418} 405}
419 406
420static inline bool fscache_object_is_dead(struct fscache_object *object) 407static inline bool fscache_object_is_active(struct fscache_object *object)
421{ 408{
422 return fscache_object_is_dying(object) && 409 return fscache_object_is_available(object) &&
423 test_bit(FSCACHE_IOERROR, &object->cache->flags); 410 fscache_object_is_live(object) &&
411 !fscache_cache_is_broken(object);
424} 412}
425 413
426/** 414/**
@@ -551,4 +539,15 @@ extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object,
551 const void *data, 539 const void *data,
552 uint16_t datalen); 540 uint16_t datalen);
553 541
542extern void fscache_object_retrying_stale(struct fscache_object *object);
543
544enum fscache_why_object_killed {
545 FSCACHE_OBJECT_IS_STALE,
546 FSCACHE_OBJECT_NO_SPACE,
547 FSCACHE_OBJECT_WAS_RETIRED,
548 FSCACHE_OBJECT_WAS_CULLED,
549};
550extern void fscache_object_mark_killed(struct fscache_object *object,
551 enum fscache_why_object_killed why);
552
554#endif /* _LINUX_FSCACHE_CACHE_H */ 553#endif /* _LINUX_FSCACHE_CACHE_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index fb0814ca65c7..a6c78e00ea96 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -671,4 +671,10 @@ static inline int add_to_page_cache(struct page *page,
671 return error; 671 return error;
672} 672}
673 673
674static inline unsigned long dir_pages(struct inode *inode)
675{
676 return (unsigned long)(inode->i_size + PAGE_CACHE_SIZE - 1) >>
677 PAGE_CACHE_SHIFT;
678}
679
674#endif /* _LINUX_PAGEMAP_H */ 680#endif /* _LINUX_PAGEMAP_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index afbb1fd77c77..912a7c482649 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -123,6 +123,7 @@ __printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
123__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args); 123__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args);
124 124
125int seq_path(struct seq_file *, const struct path *, const char *); 125int seq_path(struct seq_file *, const struct path *, const char *);
126int seq_file_path(struct seq_file *, struct file *, const char *);
126int seq_dentry(struct seq_file *, struct dentry *, const char *); 127int seq_dentry(struct seq_file *, struct dentry *, const char *);
127int seq_path_root(struct seq_file *m, const struct path *path, 128int seq_path_root(struct seq_file *m, const struct path *path,
128 const struct path *root, const char *esc); 129 const struct path *root, const char *esc);