aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
commit9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch)
treedd0a1b3396ae9414f668b0110cc39d11268ad3ed /include/linux
parentf0230294271f511b41797305b685365a9e569a09 (diff)
parentbdd3536618443809d18868563eeafa63b9d29603 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "All kinds of stuff this time around; some more notable parts: - RCU'd vfsmounts handling - new primitives for coredump handling - files_lock is gone - Bruce's delegations handling series - exportfs fixes plus misc stuff all over the place" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits) ecryptfs: ->f_op is never NULL locks: break delegations on any attribute modification locks: break delegations on link locks: break delegations on rename locks: helper functions for delegation breaking locks: break delegations on unlink namei: minor vfs_unlink cleanup locks: implement delegations locks: introduce new FL_DELEG lock flag vfs: take i_mutex on renamed file vfs: rename I_MUTEX_QUOTA now that it's not used for quotas vfs: don't use PARENT/CHILD lock classes for non-directories vfs: pull ext4's double-i_mutex-locking into common code exportfs: fix quadratic behavior in filehandle lookup exportfs: better variable name exportfs: move most of reconnect_path to helper function exportfs: eliminate unused "noprogress" counter exportfs: stop retrying once we race with rename/remove exportfs: clear DISCONNECTED on all parents sooner exportfs: more detailed comment for path_reconnect ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/coredump.h10
-rw-r--r--include/linux/dcache.h104
-rw-r--r--include/linux/elf.h6
-rw-r--r--include/linux/elfcore.h7
-rw-r--r--include/linux/fs.h106
-rw-r--r--include/linux/lglock.h10
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/pid_namespace.h1
12 files changed, 185 insertions, 71 deletions
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index cf573c22b81e..8013a45242fe 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -13,9 +13,6 @@ struct file_operations;
13struct file *anon_inode_getfile(const char *name, 13struct file *anon_inode_getfile(const char *name,
14 const struct file_operations *fops, 14 const struct file_operations *fops,
15 void *priv, int flags); 15 void *priv, int flags);
16struct file *anon_inode_getfile_private(const char *name,
17 const struct file_operations *fops,
18 void *priv, int flags);
19int anon_inode_getfd(const char *name, const struct file_operations *fops, 16int anon_inode_getfd(const char *name, const struct file_operations *fops,
20 void *priv, int flags); 17 void *priv, int flags);
21 18
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index e8112ae50531..790d3305a5a7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -56,11 +56,12 @@ struct linux_binprm {
56 56
57/* Function parameter for binfmt->coredump */ 57/* Function parameter for binfmt->coredump */
58struct coredump_params { 58struct coredump_params {
59 siginfo_t *siginfo; 59 const siginfo_t *siginfo;
60 struct pt_regs *regs; 60 struct pt_regs *regs;
61 struct file *file; 61 struct file *file;
62 unsigned long limit; 62 unsigned long limit;
63 unsigned long mm_flags; 63 unsigned long mm_flags;
64 loff_t written;
64}; 65};
65 66
66/* 67/*
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 345da00a86e0..78cdf51ff5ba 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -362,7 +362,7 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
362long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 362long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
363 unsigned long bitmap_size); 363 unsigned long bitmap_size);
364int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from); 364int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
365int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); 365int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from);
366int get_compat_sigevent(struct sigevent *event, 366int get_compat_sigevent(struct sigevent *event,
367 const struct compat_sigevent __user *u_event); 367 const struct compat_sigevent __user *u_event);
368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, 368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index a98f1ca60407..d016a121a8c4 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -10,12 +10,14 @@
10 * These are the only things you should do on a core-file: use only these 10 * These are the only things you should do on a core-file: use only these
11 * functions to write out all the necessary info. 11 * functions to write out all the necessary info.
12 */ 12 */
13extern int dump_write(struct file *file, const void *addr, int nr); 13struct coredump_params;
14extern int dump_seek(struct file *file, loff_t off); 14extern int dump_skip(struct coredump_params *cprm, size_t nr);
15extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
16extern int dump_align(struct coredump_params *cprm, int align);
15#ifdef CONFIG_COREDUMP 17#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo); 18extern void do_coredump(const siginfo_t *siginfo);
17#else 19#else
18static inline void do_coredump(siginfo_t *siginfo) {} 20static inline void do_coredump(const siginfo_t *siginfo) {}
19#endif 21#endif
20 22
21#endif /* _LINUX_COREDUMP_H */ 23#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 59066e0b4ff1..57e87e749a48 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -169,13 +169,13 @@ struct dentry_operations {
169 */ 169 */
170 170
171/* d_flags entries */ 171/* d_flags entries */
172#define DCACHE_OP_HASH 0x0001 172#define DCACHE_OP_HASH 0x00000001
173#define DCACHE_OP_COMPARE 0x0002 173#define DCACHE_OP_COMPARE 0x00000002
174#define DCACHE_OP_REVALIDATE 0x0004 174#define DCACHE_OP_REVALIDATE 0x00000004
175#define DCACHE_OP_DELETE 0x0008 175#define DCACHE_OP_DELETE 0x00000008
176#define DCACHE_OP_PRUNE 0x0010 176#define DCACHE_OP_PRUNE 0x00000010
177 177
178#define DCACHE_DISCONNECTED 0x0020 178#define DCACHE_DISCONNECTED 0x00000020
179 /* This dentry is possibly not currently connected to the dcache tree, in 179 /* This dentry is possibly not currently connected to the dcache tree, in
180 * which case its parent will either be itself, or will have this flag as 180 * which case its parent will either be itself, or will have this flag as
181 * well. nfsd will not use a dentry with this bit set, but will first 181 * well. nfsd will not use a dentry with this bit set, but will first
@@ -186,30 +186,38 @@ struct dentry_operations {
186 * dentry into place and return that dentry rather than the passed one, 186 * dentry into place and return that dentry rather than the passed one,
187 * typically using d_splice_alias. */ 187 * typically using d_splice_alias. */
188 188
189#define DCACHE_REFERENCED 0x0040 /* Recently used, don't discard. */ 189#define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */
190#define DCACHE_RCUACCESS 0x0080 /* Entry has ever been RCU-visible */ 190#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */
191 191
192#define DCACHE_CANT_MOUNT 0x0100 192#define DCACHE_CANT_MOUNT 0x00000100
193#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x00000200
194#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x00000400
195 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800 196#define DCACHE_OP_WEAK_REVALIDATE 0x00000800
197 197
198#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x00001000
199 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
200 * dput() */ 200 * dput() */
201#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */ 201#define DCACHE_COOKIE 0x00002000 /* For use by dcookie subsystem */
202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000 202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x00004000
203 /* Parent inode is watched by some fsnotify listener */ 203 /* Parent inode is watched by some fsnotify listener */
204 204
205#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 205#define DCACHE_DENTRY_KILLED 0x00008000
206#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 206
207#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 207#define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */
208#define DCACHE_NEED_AUTOMOUNT 0x00020000 /* handle automount on this dir */
209#define DCACHE_MANAGE_TRANSIT 0x00040000 /* manage transit from this dirent */
208#define DCACHE_MANAGED_DENTRY \ 210#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 211 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 212
211#define DCACHE_LRU_LIST 0x80000 213#define DCACHE_LRU_LIST 0x00080000
212#define DCACHE_DENTRY_KILLED 0x100000 214
215#define DCACHE_ENTRY_TYPE 0x00700000
216#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry */
217#define DCACHE_DIRECTORY_TYPE 0x00100000 /* Normal directory */
218#define DCACHE_AUTODIR_TYPE 0x00200000 /* Lookupless directory (presumed automount) */
219#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
220#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
213 221
214extern seqlock_t rename_lock; 222extern seqlock_t rename_lock;
215 223
@@ -224,6 +232,7 @@ static inline int dname_external(const struct dentry *dentry)
224extern void d_instantiate(struct dentry *, struct inode *); 232extern void d_instantiate(struct dentry *, struct inode *);
225extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 233extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
226extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 234extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
235extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
227extern void __d_drop(struct dentry *dentry); 236extern void __d_drop(struct dentry *dentry);
228extern void d_drop(struct dentry *dentry); 237extern void d_drop(struct dentry *dentry);
229extern void d_delete(struct dentry *); 238extern void d_delete(struct dentry *);
@@ -393,6 +402,61 @@ static inline bool d_mountpoint(const struct dentry *dentry)
393 return dentry->d_flags & DCACHE_MOUNTED; 402 return dentry->d_flags & DCACHE_MOUNTED;
394} 403}
395 404
405/*
406 * Directory cache entry type accessor functions.
407 */
408static inline void __d_set_type(struct dentry *dentry, unsigned type)
409{
410 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
411}
412
413static inline void __d_clear_type(struct dentry *dentry)
414{
415 __d_set_type(dentry, DCACHE_MISS_TYPE);
416}
417
418static inline void d_set_type(struct dentry *dentry, unsigned type)
419{
420 spin_lock(&dentry->d_lock);
421 __d_set_type(dentry, type);
422 spin_unlock(&dentry->d_lock);
423}
424
425static inline unsigned __d_entry_type(const struct dentry *dentry)
426{
427 return dentry->d_flags & DCACHE_ENTRY_TYPE;
428}
429
430static inline bool d_is_directory(const struct dentry *dentry)
431{
432 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
433}
434
435static inline bool d_is_autodir(const struct dentry *dentry)
436{
437 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
438}
439
440static inline bool d_is_symlink(const struct dentry *dentry)
441{
442 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
443}
444
445static inline bool d_is_file(const struct dentry *dentry)
446{
447 return __d_entry_type(dentry) == DCACHE_FILE_TYPE;
448}
449
450static inline bool d_is_negative(const struct dentry *dentry)
451{
452 return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
453}
454
455static inline bool d_is_positive(const struct dentry *dentry)
456{
457 return !d_is_negative(dentry);
458}
459
396extern int sysctl_vfs_cache_pressure; 460extern int sysctl_vfs_cache_pressure;
397 461
398static inline unsigned long vfs_pressure_ratio(unsigned long val) 462static inline unsigned long vfs_pressure_ratio(unsigned long val)
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 40a3c0e01b2b..67a5fa7830c4 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -39,13 +39,13 @@ extern Elf64_Dyn _DYNAMIC [];
39 39
40/* Optional callbacks to write extra ELF notes. */ 40/* Optional callbacks to write extra ELF notes. */
41struct file; 41struct file;
42struct coredump_params;
42 43
43#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 44#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
44static inline int elf_coredump_extra_notes_size(void) { return 0; } 45static inline int elf_coredump_extra_notes_size(void) { return 0; }
45static inline int elf_coredump_extra_notes_write(struct file *file, 46static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
46 loff_t *foffset) { return 0; }
47#else 47#else
48extern int elf_coredump_extra_notes_size(void); 48extern int elf_coredump_extra_notes_size(void);
49extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); 49extern int elf_coredump_extra_notes_write(struct coredump_params *cprm);
50#endif 50#endif
51#endif /* _LINUX_ELF_H */ 51#endif /* _LINUX_ELF_H */
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index cdd3d13efce7..698d51a0eea3 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -6,6 +6,8 @@
6#include <asm/elf.h> 6#include <asm/elf.h>
7#include <uapi/linux/elfcore.h> 7#include <uapi/linux/elfcore.h>
8 8
9struct coredump_params;
10
9static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) 11static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
10{ 12{
11#ifdef ELF_CORE_COPY_REGS 13#ifdef ELF_CORE_COPY_REGS
@@ -63,10 +65,9 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse
63 */ 65 */
64extern Elf_Half elf_core_extra_phdrs(void); 66extern Elf_Half elf_core_extra_phdrs(void);
65extern int 67extern int
66elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, 68elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
67 unsigned long limit);
68extern int 69extern int
69elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); 70elf_core_write_extra_data(struct coredump_params *cprm);
70extern size_t elf_core_extra_data_size(void); 71extern size_t elf_core_extra_data_size(void);
71 72
72#endif /* _LINUX_ELFCORE_H */ 73#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 955dff5da56a..bf5d574ebdf4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -623,10 +623,13 @@ static inline int inode_unhashed(struct inode *inode)
623 * 0: the object of the current VFS operation 623 * 0: the object of the current VFS operation
624 * 1: parent 624 * 1: parent
625 * 2: child/target 625 * 2: child/target
626 * 3: quota file 626 * 3: xattr
627 * 4: second non-directory
628 * The last is for certain operations (such as rename) which lock two
629 * non-directories at once.
627 * 630 *
628 * The locking order between these classes is 631 * The locking order between these classes is
629 * parent -> child -> normal -> xattr -> quota 632 * parent -> child -> normal -> xattr -> second non-directory
630 */ 633 */
631enum inode_i_mutex_lock_class 634enum inode_i_mutex_lock_class
632{ 635{
@@ -634,9 +637,12 @@ enum inode_i_mutex_lock_class
634 I_MUTEX_PARENT, 637 I_MUTEX_PARENT,
635 I_MUTEX_CHILD, 638 I_MUTEX_CHILD,
636 I_MUTEX_XATTR, 639 I_MUTEX_XATTR,
637 I_MUTEX_QUOTA 640 I_MUTEX_NONDIR2
638}; 641};
639 642
643void lock_two_nondirectories(struct inode *, struct inode*);
644void unlock_two_nondirectories(struct inode *, struct inode*);
645
640/* 646/*
641 * NOTE: in a 32bit arch with a preemptable kernel and 647 * NOTE: in a 32bit arch with a preemptable kernel and
642 * an UP compile the i_size_read/write must be atomic 648 * an UP compile the i_size_read/write must be atomic
@@ -764,12 +770,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
764#define FILE_MNT_WRITE_RELEASED 2 770#define FILE_MNT_WRITE_RELEASED 2
765 771
766struct file { 772struct file {
767 /*
768 * fu_list becomes invalid after file_free is called and queued via
769 * fu_rcuhead for RCU freeing
770 */
771 union { 773 union {
772 struct list_head fu_list;
773 struct llist_node fu_llist; 774 struct llist_node fu_llist;
774 struct rcu_head fu_rcuhead; 775 struct rcu_head fu_rcuhead;
775 } f_u; 776 } f_u;
@@ -783,9 +784,6 @@ struct file {
783 * Must not be taken from IRQ context. 784 * Must not be taken from IRQ context.
784 */ 785 */
785 spinlock_t f_lock; 786 spinlock_t f_lock;
786#ifdef CONFIG_SMP
787 int f_sb_list_cpu;
788#endif
789 atomic_long_t f_count; 787 atomic_long_t f_count;
790 unsigned int f_flags; 788 unsigned int f_flags;
791 fmode_t f_mode; 789 fmode_t f_mode;
@@ -882,6 +880,7 @@ static inline int file_check_writeable(struct file *filp)
882 880
883#define FL_POSIX 1 881#define FL_POSIX 1
884#define FL_FLOCK 2 882#define FL_FLOCK 2
883#define FL_DELEG 4 /* NFSv4 delegation */
885#define FL_ACCESS 8 /* not trying to lock, just looking */ 884#define FL_ACCESS 8 /* not trying to lock, just looking */
886#define FL_EXISTS 16 /* when unlocking, test for existence */ 885#define FL_EXISTS 16 /* when unlocking, test for existence */
887#define FL_LEASE 32 /* lease held on this file */ 886#define FL_LEASE 32 /* lease held on this file */
@@ -1023,7 +1022,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
1023extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1024extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1025extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 1024extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
1026extern int __break_lease(struct inode *inode, unsigned int flags); 1025extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
1027extern void lease_get_mtime(struct inode *, struct timespec *time); 1026extern void lease_get_mtime(struct inode *, struct timespec *time);
1028extern int generic_setlease(struct file *, long, struct file_lock **); 1027extern int generic_setlease(struct file *, long, struct file_lock **);
1029extern int vfs_setlease(struct file *, long, struct file_lock **); 1028extern int vfs_setlease(struct file *, long, struct file_lock **);
@@ -1132,7 +1131,7 @@ static inline int flock_lock_file_wait(struct file *filp,
1132 return -ENOLCK; 1131 return -ENOLCK;
1133} 1132}
1134 1133
1135static inline int __break_lease(struct inode *inode, unsigned int mode) 1134static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
1136{ 1135{
1137 return 0; 1136 return 0;
1138} 1137}
@@ -1264,11 +1263,6 @@ struct super_block {
1264 1263
1265 struct list_head s_inodes; /* all inodes */ 1264 struct list_head s_inodes; /* all inodes */
1266 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ 1265 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
1267#ifdef CONFIG_SMP
1268 struct list_head __percpu *s_files;
1269#else
1270 struct list_head s_files;
1271#endif
1272 struct list_head s_mounts; /* list of mounts; _not_ for fs use */ 1266 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1273 struct block_device *s_bdev; 1267 struct block_device *s_bdev;
1274 struct backing_dev_info *s_bdi; 1268 struct backing_dev_info *s_bdi;
@@ -1330,6 +1324,7 @@ struct super_block {
1330 */ 1324 */
1331 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1325 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1332 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1326 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1327 struct rcu_head rcu;
1333}; 1328};
1334 1329
1335extern struct timespec current_fs_time(struct super_block *sb); 1330extern struct timespec current_fs_time(struct super_block *sb);
@@ -1458,10 +1453,10 @@ extern int vfs_create(struct inode *, struct dentry *, umode_t, bool);
1458extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); 1453extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1459extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); 1454extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1460extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1455extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1461extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1456extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);
1462extern int vfs_rmdir(struct inode *, struct dentry *); 1457extern int vfs_rmdir(struct inode *, struct dentry *);
1463extern int vfs_unlink(struct inode *, struct dentry *); 1458extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1464extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 1459extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **);
1465 1460
1466/* 1461/*
1467 * VFS dentry helper functions. 1462 * VFS dentry helper functions.
@@ -1875,6 +1870,17 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1875 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1870 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
1876#define fops_put(fops) \ 1871#define fops_put(fops) \
1877 do { if (fops) module_put((fops)->owner); } while(0) 1872 do { if (fops) module_put((fops)->owner); } while(0)
1873/*
1874 * This one is to be used *ONLY* from ->open() instances.
1875 * fops must be non-NULL, pinned down *and* module dependencies
1876 * should be sufficient to pin the caller down as well.
1877 */
1878#define replace_fops(f, fops) \
1879 do { \
1880 struct file *__file = (f); \
1881 fops_put(__file->f_op); \
1882 BUG_ON(!(__file->f_op = (fops))); \
1883 } while(0)
1878 1884
1879extern int register_filesystem(struct file_system_type *); 1885extern int register_filesystem(struct file_system_type *);
1880extern int unregister_filesystem(struct file_system_type *); 1886extern int unregister_filesystem(struct file_system_type *);
@@ -1899,6 +1905,9 @@ extern bool fs_fully_visible(struct file_system_type *);
1899 1905
1900extern int current_umask(void); 1906extern int current_umask(void);
1901 1907
1908extern void ihold(struct inode * inode);
1909extern void iput(struct inode *);
1910
1902/* /sys/fs */ 1911/* /sys/fs */
1903extern struct kobject *fs_kobj; 1912extern struct kobject *fs_kobj;
1904 1913
@@ -1955,9 +1964,39 @@ static inline int locks_verify_truncate(struct inode *inode,
1955static inline int break_lease(struct inode *inode, unsigned int mode) 1964static inline int break_lease(struct inode *inode, unsigned int mode)
1956{ 1965{
1957 if (inode->i_flock) 1966 if (inode->i_flock)
1958 return __break_lease(inode, mode); 1967 return __break_lease(inode, mode, FL_LEASE);
1968 return 0;
1969}
1970
1971static inline int break_deleg(struct inode *inode, unsigned int mode)
1972{
1973 if (inode->i_flock)
1974 return __break_lease(inode, mode, FL_DELEG);
1959 return 0; 1975 return 0;
1960} 1976}
1977
1978static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
1979{
1980 int ret;
1981
1982 ret = break_deleg(inode, O_WRONLY|O_NONBLOCK);
1983 if (ret == -EWOULDBLOCK && delegated_inode) {
1984 *delegated_inode = inode;
1985 ihold(inode);
1986 }
1987 return ret;
1988}
1989
1990static inline int break_deleg_wait(struct inode **delegated_inode)
1991{
1992 int ret;
1993
1994 ret = break_deleg(*delegated_inode, O_WRONLY);
1995 iput(*delegated_inode);
1996 *delegated_inode = NULL;
1997 return ret;
1998}
1999
1961#else /* !CONFIG_FILE_LOCKING */ 2000#else /* !CONFIG_FILE_LOCKING */
1962static inline int locks_mandatory_locked(struct inode *inode) 2001static inline int locks_mandatory_locked(struct inode *inode)
1963{ 2002{
@@ -1997,6 +2036,22 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1997 return 0; 2036 return 0;
1998} 2037}
1999 2038
2039static inline int break_deleg(struct inode *inode, unsigned int mode)
2040{
2041 return 0;
2042}
2043
2044static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
2045{
2046 return 0;
2047}
2048
2049static inline int break_deleg_wait(struct inode **delegated_inode)
2050{
2051 BUG();
2052 return 0;
2053}
2054
2000#endif /* CONFIG_FILE_LOCKING */ 2055#endif /* CONFIG_FILE_LOCKING */
2001 2056
2002/* fs/open.c */ 2057/* fs/open.c */
@@ -2223,7 +2278,7 @@ extern void emergency_remount(void);
2223#ifdef CONFIG_BLOCK 2278#ifdef CONFIG_BLOCK
2224extern sector_t bmap(struct inode *, sector_t); 2279extern sector_t bmap(struct inode *, sector_t);
2225#endif 2280#endif
2226extern int notify_change(struct dentry *, struct iattr *); 2281extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2227extern int inode_permission(struct inode *, int); 2282extern int inode_permission(struct inode *, int);
2228extern int generic_permission(struct inode *, int); 2283extern int generic_permission(struct inode *, int);
2229 2284
@@ -2337,8 +2392,6 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2337extern int inode_init_always(struct super_block *, struct inode *); 2392extern int inode_init_always(struct super_block *, struct inode *);
2338extern void inode_init_once(struct inode *); 2393extern void inode_init_once(struct inode *);
2339extern void address_space_init_once(struct address_space *mapping); 2394extern void address_space_init_once(struct address_space *mapping);
2340extern void ihold(struct inode * inode);
2341extern void iput(struct inode *);
2342extern struct inode * igrab(struct inode *); 2395extern struct inode * igrab(struct inode *);
2343extern ino_t iunique(struct super_block *, ino_t); 2396extern ino_t iunique(struct super_block *, ino_t);
2344extern int inode_needs_sync(struct inode *inode); 2397extern int inode_needs_sync(struct inode *inode);
@@ -2507,8 +2560,10 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
2507 int nofs); 2560 int nofs);
2508extern int page_symlink(struct inode *inode, const char *symname, int len); 2561extern int page_symlink(struct inode *inode, const char *symname, int len);
2509extern const struct inode_operations page_symlink_inode_operations; 2562extern const struct inode_operations page_symlink_inode_operations;
2563extern void kfree_put_link(struct dentry *, struct nameidata *, void *);
2510extern int generic_readlink(struct dentry *, char __user *, int); 2564extern int generic_readlink(struct dentry *, char __user *, int);
2511extern void generic_fillattr(struct inode *, struct kstat *); 2565extern void generic_fillattr(struct inode *, struct kstat *);
2566int vfs_getattr_nosec(struct path *path, struct kstat *stat);
2512extern int vfs_getattr(struct path *, struct kstat *); 2567extern int vfs_getattr(struct path *, struct kstat *);
2513void __inode_add_bytes(struct inode *inode, loff_t bytes); 2568void __inode_add_bytes(struct inode *inode, loff_t bytes);
2514void inode_add_bytes(struct inode *inode, loff_t bytes); 2569void inode_add_bytes(struct inode *inode, loff_t bytes);
@@ -2567,6 +2622,7 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
2567extern int simple_write_end(struct file *file, struct address_space *mapping, 2622extern int simple_write_end(struct file *file, struct address_space *mapping,
2568 loff_t pos, unsigned len, unsigned copied, 2623 loff_t pos, unsigned len, unsigned copied,
2569 struct page *page, void *fsdata); 2624 struct page *page, void *fsdata);
2625extern struct inode *alloc_anon_inode(struct super_block *);
2570 2626
2571extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2627extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
2572extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 2628extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index 0d24e932db0b..96549abe8842 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -25,16 +25,6 @@
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/notifier.h> 26#include <linux/notifier.h>
27 27
28/* can make br locks by using local lock for read side, global lock for write */
29#define br_lock_init(name) lg_lock_init(name, #name)
30#define br_read_lock(name) lg_local_lock(name)
31#define br_read_unlock(name) lg_local_unlock(name)
32#define br_write_lock(name) lg_global_lock(name)
33#define br_write_unlock(name) lg_global_unlock(name)
34
35#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
36#define DEFINE_STATIC_BRLOCK(name) DEFINE_STATIC_LGLOCK(name)
37
38#ifdef CONFIG_DEBUG_LOCK_ALLOC 28#ifdef CONFIG_DEBUG_LOCK_ALLOC
39#define LOCKDEP_INIT_MAP lockdep_init_map 29#define LOCKDEP_INIT_MAP lockdep_init_map
40#else 30#else
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 38cd98f112a0..371d346fa270 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -49,6 +49,8 @@ struct mnt_namespace;
49 49
50#define MNT_LOCK_READONLY 0x400000 50#define MNT_LOCK_READONLY 0x400000
51#define MNT_LOCKED 0x800000 51#define MNT_LOCKED 0x800000
52#define MNT_DOOMED 0x1000000
53#define MNT_SYNC_UMOUNT 0x2000000
52 54
53struct vfsmount { 55struct vfsmount {
54 struct dentry *mnt_root; /* root of the mounted tree */ 56 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 8e47bc7a1665..492de72560fa 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -16,7 +16,7 @@ struct nameidata {
16 struct path root; 16 struct path root;
17 struct inode *inode; /* path.dentry.d_inode */ 17 struct inode *inode; /* path.dentry.d_inode */
18 unsigned int flags; 18 unsigned int flags;
19 unsigned seq; 19 unsigned seq, m_seq;
20 int last_type; 20 int last_type;
21 unsigned depth; 21 unsigned depth;
22 char *saved_names[MAX_NESTED_LINKS + 1]; 22 char *saved_names[MAX_NESTED_LINKS + 1];
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e2772666f004..7246ef3d4455 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -23,6 +23,7 @@ struct bsd_acct_struct;
23struct pid_namespace { 23struct pid_namespace {
24 struct kref kref; 24 struct kref kref;
25 struct pidmap pidmap[PIDMAP_ENTRIES]; 25 struct pidmap pidmap[PIDMAP_ENTRIES];
26 struct rcu_head rcu;
26 int last_pid; 27 int last_pid;
27 unsigned int nr_hashed; 28 unsigned int nr_hashed;
28 struct task_struct *child_reaper; 29 struct task_struct *child_reaper;