Skip to content

Commit 4b9d25b

Browse files
committed
Merge tag 'vfs-6.19-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: - Fix a type conversion bug in the ipc subsystem - Fix per-dentry timeout warning in autofs - Drop the fd conversion from sockets - Move assert from iput_not_last() to iput() - Fix reversed check in filesystems_freeze_callback() - Use proper uapi types for new struct delegation definitions * tag 'vfs-6.19-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: vfs: use UAPI types for new struct delegation definition mqueue: correct the type of ro to int Revert "net/socket: convert sock_map_fd() to FD_ADD()" autofs: fix per-dentry timeout warning fs: assert on I_FREEING not being set in iput() and iput_not_last() fs: PM: Fix reverse check in filesystems_freeze_callback()
2 parents e40e023 + fe93446 commit 4b9d25b

6 files changed

Lines changed: 33 additions & 25 deletions

File tree

fs/autofs/dev-ioctl.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,16 +432,6 @@ static int autofs_dev_ioctl_timeout(struct file *fp,
432432
if (!autofs_type_indirect(sbi->type))
433433
return -EINVAL;
434434

435-
/* An expire timeout greater than the superblock timeout
436-
* could be a problem at shutdown but the super block
437-
* timeout itself can change so all we can really do is
438-
* warn the user.
439-
*/
440-
if (timeout >= sbi->exp_timeout)
441-
pr_warn("per-mount expire timeout is greater than "
442-
"the parent autofs mount timeout which could "
443-
"prevent shutdown\n");
444-
445435
dentry = try_lookup_noperm(&QSTR_LEN(param->path, path_len),
446436
base);
447437
if (IS_ERR_OR_NULL(dentry))
@@ -470,6 +460,18 @@ static int autofs_dev_ioctl_timeout(struct file *fp,
470460
ino->flags |= AUTOFS_INF_EXPIRE_SET;
471461
ino->exp_timeout = timeout * HZ;
472462
}
463+
464+
/* An expire timeout greater than the superblock timeout
465+
* could be a problem at shutdown but the super block
466+
* timeout itself can change so all we can really do is
467+
* warn the user.
468+
*/
469+
if (ino->flags & AUTOFS_INF_EXPIRE_SET &&
470+
ino->exp_timeout > sbi->exp_timeout)
471+
pr_warn("per-mount expire timeout is greater than "
472+
"the parent autofs mount timeout which could "
473+
"prevent shutdown\n");
474+
473475
dput(dentry);
474476
}
475477

fs/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ void iput(struct inode *inode)
19681968

19691969
retry:
19701970
lockdep_assert_not_held(&inode->i_lock);
1971-
VFS_BUG_ON_INODE(inode_state_read_once(inode) & I_CLEAR, inode);
1971+
VFS_BUG_ON_INODE(inode_state_read_once(inode) & (I_FREEING | I_CLEAR), inode);
19721972
/*
19731973
* Note this assert is technically racy as if the count is bogusly
19741974
* equal to one, then two CPUs racing to further drop it can both
@@ -2010,6 +2010,7 @@ EXPORT_SYMBOL(iput);
20102010
*/
20112011
void iput_not_last(struct inode *inode)
20122012
{
2013+
VFS_BUG_ON_INODE(inode_state_read_once(inode) & (I_FREEING | I_CLEAR), inode);
20132014
VFS_BUG_ON_INODE(atomic_read(&inode->i_count) < 2, inode);
20142015

20152016
WARN_ON(atomic_sub_return(1, &inode->i_count) == 0);

fs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ static void filesystems_freeze_callback(struct super_block *sb, void *freeze_all
11891189
if (!sb->s_op->freeze_fs && !sb->s_op->freeze_super)
11901190
return;
11911191

1192-
if (freeze_all_ptr && !(sb->s_type->fs_flags & FS_POWER_FREEZE))
1192+
if (!freeze_all_ptr && !(sb->s_type->fs_flags & FS_POWER_FREEZE))
11931193
return;
11941194

11951195
if (!get_active_super(sb))

include/uapi/linux/fcntl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
#include <asm/fcntl.h>
66
#include <linux/openat2.h>
7-
#ifdef __KERNEL__
87
#include <linux/types.h>
9-
#else
10-
#include <stdint.h>
11-
#endif
128

139
#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
1410
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
@@ -90,9 +86,9 @@
9086

9187
/* Argument structure for F_GETDELEG and F_SETDELEG */
9288
struct delegation {
93-
uint32_t d_flags; /* Must be 0 */
94-
uint16_t d_type; /* F_RDLCK, F_WRLCK, F_UNLCK */
95-
uint16_t __pad; /* Must be 0 */
89+
__u32 d_flags; /* Must be 0 */
90+
__u16 d_type; /* F_RDLCK, F_WRLCK, F_UNLCK */
91+
__u16 __pad; /* Must be 0 */
9692
};
9793

9894
/*

ipc/mqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
887887
}
888888

889889
static struct file *mqueue_file_open(struct filename *name,
890-
struct vfsmount *mnt, int oflag, bool ro,
890+
struct vfsmount *mnt, int oflag, int ro,
891891
umode_t mode, struct mq_attr *attr)
892892
{
893893
struct dentry *dentry;

net/socket.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,21 @@ EXPORT_SYMBOL(sock_alloc_file);
503503

504504
static int sock_map_fd(struct socket *sock, int flags)
505505
{
506-
int fd;
507-
508-
fd = FD_ADD(flags, sock_alloc_file(sock, flags, NULL));
509-
if (fd < 0)
506+
struct file *newfile;
507+
int fd = get_unused_fd_flags(flags);
508+
if (unlikely(fd < 0)) {
510509
sock_release(sock);
511-
return fd;
510+
return fd;
511+
}
512+
513+
newfile = sock_alloc_file(sock, flags, NULL);
514+
if (!IS_ERR(newfile)) {
515+
fd_install(fd, newfile);
516+
return fd;
517+
}
518+
519+
put_unused_fd(fd);
520+
return PTR_ERR(newfile);
512521
}
513522

514523
/**

0 commit comments

Comments
 (0)