From: Linus Torvalds Date: Sat, 25 Feb 2023 03:01:15 +0000 (-0800) Subject: Merge branch 'work.minix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=397aa6b63ff25cee0b8ed20a6d447527c8ab0849;p=linux.git Merge branch 'work.minix' of git://git./linux/kernel/git/viro/vfs Pull minix updates from Al Viro: "Assorted fixes - mostly Christoph's" * 'work.minix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: minix_rename(): minix_delete_entry() might fail minix: don't flush page immediately for DIRSYNC directories minix: fix error handling in minix_set_link minix: fix error handling in minix_delete_entry minix: move releasing pages into unlink and rename minix: make minix_new_inode() return error as ERR_PTR(-E...) --- 397aa6b63ff25cee0b8ed20a6d447527c8ab0849 diff --cc fs/minix/bitmap.c index 724d8191a3101,af50d8e9cd89d..870207ba23f1c --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c @@@ -250,9 -247,9 +247,9 @@@ struct inode *minix_new_inode(const str j += i * bits_per_zone; if (!j || j > sbi->s_ninodes) { iput(inode); - return NULL; + return ERR_PTR(-ENOSPC); } - inode_init_owner(&init_user_ns, inode, dir, mode); + inode_init_owner(&nop_mnt_idmap, inode, dir, mode); inode->i_ino = j; inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); inode->i_blocks = 0; diff --cc fs/minix/namei.c index 39ebe10d6a8bd,b99696b90b429..956d5183828dc --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@@ -33,57 -33,55 +33,55 @@@ static struct dentry *minix_lookup(stru return d_splice_alias(inode, dentry); } -static int minix_mknod(struct user_namespace *mnt_userns, struct inode *dir, +static int minix_mknod(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) { - int error; struct inode *inode; if (!old_valid_dev(rdev)) return -EINVAL; - inode = minix_new_inode(dir, mode, &error); + inode = minix_new_inode(dir, mode); + if (IS_ERR(inode)) + return PTR_ERR(inode); - if (inode) { - minix_set_inode(inode, rdev); - mark_inode_dirty(inode); - error = add_nondir(dentry, inode); - } - return error; + minix_set_inode(inode, rdev); + mark_inode_dirty(inode); + return add_nondir(dentry, inode); } -static int minix_tmpfile(struct user_namespace *mnt_userns, struct inode *dir, +static int minix_tmpfile(struct mnt_idmap *idmap, struct inode *dir, struct file *file, umode_t mode) { - int error; - struct inode *inode = minix_new_inode(dir, mode, &error); - if (inode) { - minix_set_inode(inode, 0); - mark_inode_dirty(inode); - d_tmpfile(file, inode); - } - return finish_open_simple(file, error); + struct inode *inode = minix_new_inode(dir, mode); + + if (IS_ERR(inode)) + return finish_open_simple(file, PTR_ERR(inode)); + minix_set_inode(inode, 0); + mark_inode_dirty(inode); + d_tmpfile(file, inode); + return finish_open_simple(file, 0); } -static int minix_create(struct user_namespace *mnt_userns, struct inode *dir, +static int minix_create(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { - return minix_mknod(mnt_userns, dir, dentry, mode, 0); + return minix_mknod(&nop_mnt_idmap, dir, dentry, mode, 0); } -static int minix_symlink(struct user_namespace *mnt_userns, struct inode *dir, +static int minix_symlink(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, const char *symname) { - int err = -ENAMETOOLONG; int i = strlen(symname)+1; struct inode * inode; + int err; if (i > dir->i_sb->s_blocksize) - goto out; + return -ENAMETOOLONG; - inode = minix_new_inode(dir, S_IFLNK | 0777, &err); - if (!inode) - goto out; + inode = minix_new_inode(dir, S_IFLNK | 0777); + if (IS_ERR(inode)) + return PTR_ERR(inode); minix_set_inode(inode, 0); err = page_symlink(inode, symname, i);