]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge tag 'locks-v4.5-1' of git://git.samba.org/jlayton/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Jan 2016 23:46:17 +0000 (15:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Jan 2016 23:46:17 +0000 (15:46 -0800)
Pull file locking updates from Jeff Layton:
 "File locking related changes for v4.5 (pile #1)

  Highlights:
   - new Kconfig option to allow disabling mandatory locking (which is
     racy anyway)
   - new tracepoints for setlk and close codepaths
   - fix for a long-standing bug in code that handles races between
     setting a POSIX lock and close()"

* tag 'locks-v4.5-1' of git://git.samba.org/jlayton/linux:
  locks: rename __posix_lock_file to posix_lock_inode
  locks: prink more detail when there are leaked locks
  locks: pass inode pointer to locks_free_lock_context
  locks: sprinkle some tracepoints around the file locking code
  locks: don't check for race with close when setting OFD lock
  locks: fix unlock when fcntl_setlk races with a close
  fs: make locks.c explicitly non-modular
  locks: use list_first_entry_or_null()
  locks: Don't allow mounts in user namespaces to enable mandatory locking
  locks: Allow disabling mandatory locking at compile time

1  2 
fs/Kconfig
fs/inode.c
include/linux/fs.h

diff --combined fs/Kconfig
index 6ce72d8d1ee12473bfcb1e550967be2a0a1c8d27,59322e6e76f4b89f146a9af8a9e4ead130c93818..2bb1ef86c411a5483087ba106778532dc661a081
@@@ -46,12 -46,6 +46,12 @@@ config FS_DA
          or if unsure, say N.  Saying Y will increase the size of the kernel
          by about 5kB.
  
 +config FS_DAX_PMD
 +      bool
 +      default FS_DAX
 +      depends on FS_DAX
 +      depends on BROKEN
 +
  endif # BLOCK
  
  # Posix ACL utility routines
@@@ -73,6 -67,16 +73,16 @@@ config FILE_LOCKIN
            for filesystems like NFS and for the flock() system
            call. Disabling this option saves about 11k.
  
+ config MANDATORY_FILE_LOCKING
+       bool "Enable Mandatory file locking"
+       depends on FILE_LOCKING
+       default y
+       help
+         This option enables files appropriately marked files on appropriely
+         mounted filesystems to support mandatory locking.
+         To the best of my knowledge this is dead code that no one cares about.
  source "fs/notify/Kconfig"
  
  source "fs/quota/Kconfig"
diff --combined fs/inode.c
index 5bb85a064ce7fade86383db89c252fe920032279,ab6c84159f9d9e367f8edd92146204c42f770d47..4230f66b741017adaf080ead885896212485d906
@@@ -225,7 -225,7 +225,7 @@@ void __destroy_inode(struct inode *inod
        inode_detach_wb(inode);
        security_inode_free(inode);
        fsnotify_inode_delete(inode);
-       locks_free_lock_context(inode->i_flctx);
+       locks_free_lock_context(inode);
        if (!inode->i_nlink) {
                WARN_ON(atomic_long_read(&inode->i_sb->s_remove_count) == 0);
                atomic_long_dec(&inode->i_sb->s_remove_count);
@@@ -2028,9 -2028,3 +2028,9 @@@ void inode_set_flags(struct inode *inod
                                  new_flags) != old_flags));
  }
  EXPORT_SYMBOL(inode_set_flags);
 +
 +void inode_nohighmem(struct inode *inode)
 +{
 +      mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
 +}
 +EXPORT_SYMBOL(inode_nohighmem);
diff --combined include/linux/fs.h
index ef3cd36689f630df7bd895855f52e6d05f5df5b5,6c4983aceb02d92a3b1e16f89b3d03c7adc9c3fb..566f8e078ffc8f3c4e310cd43422f25c31481215
@@@ -31,7 -31,6 +31,7 @@@
  #include <linux/blk_types.h>
  #include <linux/workqueue.h>
  #include <linux/percpu-rwsem.h>
 +#include <linux/delayed_call.h>
  
  #include <asm/byteorder.h>
  #include <uapi/linux/fs.h>
@@@ -1043,7 -1042,7 +1043,7 @@@ extern int fcntl_setlease(unsigned int 
  extern int fcntl_getlease(struct file *filp);
  
  /* fs/locks.c */
- void locks_free_lock_context(struct file_lock_context *ctx);
+ void locks_free_lock_context(struct inode *inode);
  void locks_free_lock(struct file_lock *fl);
  extern void locks_init_lock(struct file_lock *);
  extern struct file_lock * locks_alloc_lock(void);
@@@ -1104,7 -1103,7 +1104,7 @@@ static inline int fcntl_getlease(struc
  }
  
  static inline void
- locks_free_lock_context(struct file_lock_context *ctx)
+ locks_free_lock_context(struct inode *inode)
  {
  }
  
@@@ -1634,11 -1633,12 +1634,11 @@@ struct file_operations 
  
  struct inode_operations {
        struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
 -      const char * (*follow_link) (struct dentry *, void **);
 +      const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *);
        int (*permission) (struct inode *, int);
        struct posix_acl * (*get_acl)(struct inode *, int);
  
        int (*readlink) (struct dentry *, char __user *,int);
 -      void (*put_link) (struct inode *, void *);
  
        int (*create) (struct inode *,struct dentry *, umode_t, bool);
        int (*link) (struct dentry *,struct inode *,struct dentry *);
@@@ -2030,7 -2030,7 +2030,7 @@@ extern struct kobject *fs_kobj
  #define FLOCK_VERIFY_READ  1
  #define FLOCK_VERIFY_WRITE 2
  
- #ifdef CONFIG_FILE_LOCKING
+ #ifdef CONFIG_MANDATORY_FILE_LOCKING
  extern int locks_mandatory_locked(struct file *);
  extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
  
@@@ -2075,6 -2075,45 +2075,45 @@@ static inline int locks_verify_truncate
        return 0;
  }
  
+ #else /* !CONFIG_MANDATORY_FILE_LOCKING */
+ static inline int locks_mandatory_locked(struct file *file)
+ {
+       return 0;
+ }
+ static inline int locks_mandatory_area(int rw, struct inode *inode,
+                                      struct file *filp, loff_t offset,
+                                      size_t count)
+ {
+       return 0;
+ }
+ static inline int __mandatory_lock(struct inode *inode)
+ {
+       return 0;
+ }
+ static inline int mandatory_lock(struct inode *inode)
+ {
+       return 0;
+ }
+ static inline int locks_verify_locked(struct file *file)
+ {
+       return 0;
+ }
+ static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
+                                       size_t size)
+ {
+       return 0;
+ }
+ #endif /* CONFIG_MANDATORY_FILE_LOCKING */
+ #ifdef CONFIG_FILE_LOCKING
  static inline int break_lease(struct inode *inode, unsigned int mode)
  {
        /*
@@@ -2136,39 -2175,6 +2175,6 @@@ static inline int break_layout(struct i
  }
  
  #else /* !CONFIG_FILE_LOCKING */
- static inline int locks_mandatory_locked(struct file *file)
- {
-       return 0;
- }
- static inline int locks_mandatory_area(int rw, struct inode *inode,
-                                      struct file *filp, loff_t offset,
-                                      size_t count)
- {
-       return 0;
- }
- static inline int __mandatory_lock(struct inode *inode)
- {
-       return 0;
- }
- static inline int mandatory_lock(struct inode *inode)
- {
-       return 0;
- }
- static inline int locks_verify_locked(struct file *file)
- {
-       return 0;
- }
- static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
-                                       size_t size)
- {
-       return 0;
- }
  static inline int break_lease(struct inode *inode, unsigned int mode)
  {
        return 0;
@@@ -2736,14 -2742,14 +2742,14 @@@ extern const struct file_operations gen
  
  extern int readlink_copy(char __user *, int, const char *);
  extern int page_readlink(struct dentry *, char __user *, int);
 -extern const char *page_follow_link_light(struct dentry *, void **);
 -extern void page_put_link(struct inode *, void *);
 +extern const char *page_get_link(struct dentry *, struct inode *,
 +                               struct delayed_call *);
 +extern void page_put_link(void *);
  extern int __page_symlink(struct inode *inode, const char *symname, int len,
                int nofs);
  extern int page_symlink(struct inode *inode, const char *symname, int len);
  extern const struct inode_operations page_symlink_inode_operations;
 -extern void kfree_put_link(struct inode *, void *);
 -extern void free_page_put_link(struct inode *, void *);
 +extern void kfree_link(void *);
  extern int generic_readlink(struct dentry *, char __user *, int);
  extern void generic_fillattr(struct inode *, struct kstat *);
  int vfs_getattr_nosec(struct path *path, struct kstat *stat);
@@@ -2754,8 -2760,7 +2760,8 @@@ void __inode_sub_bytes(struct inode *in
  void inode_sub_bytes(struct inode *inode, loff_t bytes);
  loff_t inode_get_bytes(struct inode *inode);
  void inode_set_bytes(struct inode *inode, loff_t bytes);
 -const char *simple_follow_link(struct dentry *, void **);
 +const char *simple_get_link(struct dentry *, struct inode *,
 +                          struct delayed_call *);
  extern const struct inode_operations simple_symlink_inode_operations;
  
  extern int iterate_dir(struct file *, struct dir_context *);
@@@ -2765,6 -2770,8 +2771,6 @@@ extern int vfs_lstat(const char __user 
  extern int vfs_fstat(unsigned int, struct kstat *);
  extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
  
 -extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
 -                  unsigned long arg);
  extern int __generic_block_fiemap(struct inode *inode,
                                  struct fiemap_extent_info *fieinfo,
                                  loff_t start, loff_t len,
@@@ -3024,6 -3031,5 +3030,6 @@@ static inline bool dir_relax(struct ino
  }
  
  extern bool path_noexec(const struct path *path);
 +extern void inode_nohighmem(struct inode *inode);
  
  #endif /* _LINUX_FS_H */