Merge tag 'locks-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux
Pull file locking updates from Jeff Layton: "This starts with a couple of fixes for potential deadlocks in the fowner/fasync handling. The next patch removes the old mandatory locking code from the kernel altogether. The last patch cleans up rw_verify_area a bit more after the mandatory locking removal" * tag 'locks-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux: fs: clean up after mandatory file locking support removal fs: remove mandatory file locking support fcntl: fix potential deadlock for &fasync_struct.fa_lock fcntl: fix potential deadlocks for &fown_struct.lock
This commit is contained in:
@@ -2612,90 +2612,6 @@ extern struct kobject *fs_kobj;
|
||||
|
||||
#define MAX_RW_COUNT (INT_MAX & PAGE_MASK)
|
||||
|
||||
#ifdef CONFIG_MANDATORY_FILE_LOCKING
|
||||
extern int locks_mandatory_locked(struct file *);
|
||||
extern int locks_mandatory_area(struct inode *, struct file *, loff_t, loff_t, unsigned char);
|
||||
|
||||
/*
|
||||
* Candidates for mandatory locking have the setgid bit set
|
||||
* but no group execute bit - an otherwise meaningless combination.
|
||||
*/
|
||||
|
||||
static inline int __mandatory_lock(struct inode *ino)
|
||||
{
|
||||
return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
|
||||
}
|
||||
|
||||
/*
|
||||
* ... and these candidates should be on SB_MANDLOCK mounted fs,
|
||||
* otherwise these will be advisory locks
|
||||
*/
|
||||
|
||||
static inline int mandatory_lock(struct inode *ino)
|
||||
{
|
||||
return IS_MANDLOCK(ino) && __mandatory_lock(ino);
|
||||
}
|
||||
|
||||
static inline int locks_verify_locked(struct file *file)
|
||||
{
|
||||
if (mandatory_lock(locks_inode(file)))
|
||||
return locks_mandatory_locked(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int locks_verify_truncate(struct inode *inode,
|
||||
struct file *f,
|
||||
loff_t size)
|
||||
{
|
||||
if (!inode->i_flctx || !mandatory_lock(inode))
|
||||
return 0;
|
||||
|
||||
if (size < inode->i_size) {
|
||||
return locks_mandatory_area(inode, f, size, inode->i_size - 1,
|
||||
F_WRLCK);
|
||||
} else {
|
||||
return locks_mandatory_area(inode, f, inode->i_size, size - 1,
|
||||
F_WRLCK);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !CONFIG_MANDATORY_FILE_LOCKING */
|
||||
|
||||
static inline int locks_mandatory_locked(struct file *file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int locks_mandatory_area(struct inode *inode, struct file *filp,
|
||||
loff_t start, loff_t end, unsigned char type)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user