From: Greg Kroah-Hartman Date: Sat, 26 May 2018 13:26:35 +0000 (+0200) Subject: fix up 4.4.y patch X-Git-Tag: v3.18.111~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbd88f2ea979959583957cbeb991b7598ada2930;p=thirdparty%2Fkernel%2Fstable-queue.git fix up 4.4.y patch --- diff --git a/queue-4.4/do-d_instantiate-unlock_new_inode-combinations-safely.patch b/queue-4.4/do-d_instantiate-unlock_new_inode-combinations-safely.patch index 88f222eff22..41b4b636a33 100644 --- a/queue-4.4/do-d_instantiate-unlock_new_inode-combinations-safely.patch +++ b/queue-4.4/do-d_instantiate-unlock_new_inode-combinations-safely.patch @@ -31,11 +31,25 @@ Reviewed-by: Andreas Dilger Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index e064c49c9a9a..9e97cbb4f006 100644 +--- + fs/btrfs/inode.c | 16 ++++------------ + fs/dcache.c | 22 ++++++++++++++++++++++ + fs/ecryptfs/inode.c | 3 +-- + fs/ext2/namei.c | 6 ++---- + fs/ext4/namei.c | 6 ++---- + fs/f2fs/namei.c | 12 ++++-------- + fs/jffs2/dir.c | 12 ++++-------- + fs/jfs/namei.c | 12 ++++-------- + fs/nilfs2/namei.c | 6 ++---- + fs/reiserfs/namei.c | 12 ++++-------- + fs/udf/namei.c | 6 ++---- + fs/ufs/namei.c | 6 ++---- + include/linux/dcache.h | 1 + + 13 files changed, 54 insertions(+), 66 deletions(-) + --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c -@@ -6575,8 +6575,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, +@@ -6413,8 +6413,7 @@ static int btrfs_mknod(struct inode *dir goto out_unlock_inode; } else { btrfs_update_inode(trans, root, inode); @@ -45,7 +59,7 @@ index e064c49c9a9a..9e97cbb4f006 100644 } out_unlock: -@@ -6652,8 +6651,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, +@@ -6489,8 +6488,7 @@ static int btrfs_create(struct inode *di goto out_unlock_inode; BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; @@ -54,8 +68,8 @@ index e064c49c9a9a..9e97cbb4f006 100644 + d_instantiate_new(dentry, inode); out_unlock: - btrfs_end_transaction(trans); -@@ -6798,12 +6796,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) + btrfs_end_transaction(trans, root); +@@ -6633,12 +6631,7 @@ static int btrfs_mkdir(struct inode *dir if (err) goto out_fail_inode; @@ -69,7 +83,7 @@ index e064c49c9a9a..9e97cbb4f006 100644 drop_on_err = 0; out_fail: -@@ -10246,8 +10239,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, +@@ -9789,8 +9782,7 @@ static int btrfs_symlink(struct inode *d goto out_unlock_inode; } @@ -78,14 +92,12 @@ index e064c49c9a9a..9e97cbb4f006 100644 + d_instantiate_new(dentry, inode); out_unlock: - btrfs_end_transaction(trans); -diff --git a/fs/dcache.c b/fs/dcache.c -index 86d2de63461e..2acfc69878f5 100644 + btrfs_end_transaction(trans, root); --- a/fs/dcache.c +++ b/fs/dcache.c -@@ -1899,6 +1899,28 @@ void d_instantiate(struct dentry *entry, struct inode * inode) - } - EXPORT_SYMBOL(d_instantiate); +@@ -1897,6 +1897,28 @@ struct dentry *d_instantiate_unique(stru + + EXPORT_SYMBOL(d_instantiate_unique); +/* + * This should be equivalent to d_instantiate() + unlock_new_inode(), @@ -112,12 +124,10 @@ index 86d2de63461e..2acfc69878f5 100644 /** * d_instantiate_no_diralias - instantiate a non-aliased dentry * @entry: dentry to complete -diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c -index 847904aa63a9..7bba8f2693b2 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c -@@ -283,8 +283,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, - iget_failed(ecryptfs_inode); +@@ -287,8 +287,7 @@ ecryptfs_create(struct inode *directory_ + iput(ecryptfs_inode); goto out; } - unlock_new_inode(ecryptfs_inode); @@ -126,11 +136,9 @@ index 847904aa63a9..7bba8f2693b2 100644 out: return rc; } -diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c -index 55f7caadb093..152453a91877 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c -@@ -41,8 +41,7 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) +@@ -40,8 +40,7 @@ static inline int ext2_add_nondir(struct { int err = ext2_add_link(dentry, inode); if (!err) { @@ -140,7 +148,7 @@ index 55f7caadb093..152453a91877 100644 return 0; } inode_dec_link_count(inode); -@@ -255,8 +254,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) +@@ -267,8 +266,7 @@ static int ext2_mkdir(struct inode * dir if (err) goto out_fail; @@ -150,11 +158,9 @@ index 55f7caadb093..152453a91877 100644 out: return err; -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index b1f21e3a0763..4a09063ce1d2 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c -@@ -2411,8 +2411,7 @@ static int ext4_add_nondir(handle_t *handle, +@@ -2429,8 +2429,7 @@ static int ext4_add_nondir(handle_t *han int err = ext4_add_entry(handle, dentry, inode); if (!err) { ext4_mark_inode_dirty(handle, inode); @@ -164,7 +170,7 @@ index b1f21e3a0763..4a09063ce1d2 100644 return 0; } drop_nlink(inode); -@@ -2651,8 +2650,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) +@@ -2669,8 +2668,7 @@ out_clear_inode: err = ext4_mark_inode_dirty(handle, dir); if (err) goto out_clear_inode; @@ -174,11 +180,9 @@ index b1f21e3a0763..4a09063ce1d2 100644 if (IS_DIRSYNC(dir)) ext4_handle_sync(handle); -diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c -index d5098efe577c..75e37fd720b2 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c -@@ -294,8 +294,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, +@@ -150,8 +150,7 @@ static int f2fs_create(struct inode *dir alloc_nid_done(sbi, ino); @@ -188,8 +192,8 @@ index d5098efe577c..75e37fd720b2 100644 if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); -@@ -597,8 +596,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, - err = page_symlink(inode, disk_link.name, disk_link.len); +@@ -399,8 +398,7 @@ static int f2fs_symlink(struct inode *di + err = page_symlink(inode, p_str, p_len); err_out: - d_instantiate(dentry, inode); @@ -198,7 +202,7 @@ index d5098efe577c..75e37fd720b2 100644 /* * Let's flush symlink data in order to avoid broken symlink as much as -@@ -661,8 +659,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) +@@ -454,8 +452,7 @@ static int f2fs_mkdir(struct inode *dir, alloc_nid_done(sbi, inode->i_ino); @@ -208,7 +212,7 @@ index d5098efe577c..75e37fd720b2 100644 if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); -@@ -713,8 +710,7 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry, +@@ -499,8 +496,7 @@ static int f2fs_mknod(struct inode *dir, alloc_nid_done(sbi, inode->i_ino); @@ -218,11 +222,9 @@ index d5098efe577c..75e37fd720b2 100644 if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); -diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c -index 0a754f38462e..e5a6deb38e1e 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c -@@ -209,8 +209,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, +@@ -207,8 +207,7 @@ static int jffs2_create(struct inode *di __func__, inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->pino_nlink, inode->i_mapping->nrpages); @@ -232,7 +234,7 @@ index 0a754f38462e..e5a6deb38e1e 100644 return 0; fail: -@@ -430,8 +429,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char +@@ -428,8 +427,7 @@ static int jffs2_symlink (struct inode * mutex_unlock(&dir_f->sem); jffs2_complete_reservation(c); @@ -242,7 +244,7 @@ index 0a754f38462e..e5a6deb38e1e 100644 return 0; fail: -@@ -575,8 +573,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode +@@ -573,8 +571,7 @@ static int jffs2_mkdir (struct inode *di mutex_unlock(&dir_f->sem); jffs2_complete_reservation(c); @@ -252,7 +254,7 @@ index 0a754f38462e..e5a6deb38e1e 100644 return 0; fail: -@@ -747,8 +744,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode +@@ -745,8 +742,7 @@ static int jffs2_mknod (struct inode *di mutex_unlock(&dir_f->sem); jffs2_complete_reservation(c); @@ -262,11 +264,9 @@ index 0a754f38462e..e5a6deb38e1e 100644 return 0; fail: -diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c -index b41596d71858..56c3fcbfe80e 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c -@@ -178,8 +178,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, +@@ -178,8 +178,7 @@ static int jfs_create(struct inode *dip, unlock_new_inode(ip); iput(ip); } else { @@ -276,7 +276,7 @@ index b41596d71858..56c3fcbfe80e 100644 } out2: -@@ -313,8 +312,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) +@@ -313,8 +312,7 @@ static int jfs_mkdir(struct inode *dip, unlock_new_inode(ip); iput(ip); } else { @@ -286,7 +286,7 @@ index b41596d71858..56c3fcbfe80e 100644 } out2: -@@ -1059,8 +1057,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, +@@ -1058,8 +1056,7 @@ static int jfs_symlink(struct inode *dip unlock_new_inode(ip); iput(ip); } else { @@ -296,7 +296,7 @@ index b41596d71858..56c3fcbfe80e 100644 } out2: -@@ -1447,8 +1444,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, +@@ -1443,8 +1440,7 @@ static int jfs_mknod(struct inode *dir, unlock_new_inode(ip); iput(ip); } else { @@ -306,13 +306,11 @@ index b41596d71858..56c3fcbfe80e 100644 } out1: -diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c -index 1a2894aa0194..dd52d3f82e8d 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c -@@ -46,8 +46,7 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) +@@ -50,8 +50,7 @@ static inline int nilfs_add_nondir(struc + { int err = nilfs_add_link(dentry, inode); - if (!err) { - d_instantiate(dentry, inode); - unlock_new_inode(inode); @@ -320,7 +318,7 @@ index 1a2894aa0194..dd52d3f82e8d 100644 return 0; } inode_dec_link_count(inode); -@@ -243,8 +242,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) +@@ -246,8 +245,7 @@ static int nilfs_mkdir(struct inode *dir goto out_fail; nilfs_mark_inode_dirty(inode); @@ -330,45 +328,9 @@ index 1a2894aa0194..dd52d3f82e8d 100644 out: if (!err) err = nilfs_transaction_commit(dir->i_sb); -diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c -index 6e3134e6d98a..1b5707c44c3f 100644 ---- a/fs/orangefs/namei.c -+++ b/fs/orangefs/namei.c -@@ -75,8 +75,7 @@ static int orangefs_create(struct inode *dir, - get_khandle_from_ino(inode), - dentry); - -- d_instantiate(dentry, inode); -- unlock_new_inode(inode); -+ d_instantiate_new(dentry, inode); - orangefs_set_timeout(dentry); - ORANGEFS_I(inode)->getattr_time = jiffies - 1; - ORANGEFS_I(inode)->getattr_mask = STATX_BASIC_STATS; -@@ -332,8 +331,7 @@ static int orangefs_symlink(struct inode *dir, - "Assigned symlink inode new number of %pU\n", - get_khandle_from_ino(inode)); - -- d_instantiate(dentry, inode); -- unlock_new_inode(inode); -+ d_instantiate_new(dentry, inode); - orangefs_set_timeout(dentry); - ORANGEFS_I(inode)->getattr_time = jiffies - 1; - ORANGEFS_I(inode)->getattr_mask = STATX_BASIC_STATS; -@@ -402,8 +400,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode - "Assigned dir inode new number of %pU\n", - get_khandle_from_ino(inode)); - -- d_instantiate(dentry, inode); -- unlock_new_inode(inode); -+ d_instantiate_new(dentry, inode); - orangefs_set_timeout(dentry); - ORANGEFS_I(inode)->getattr_time = jiffies - 1; - ORANGEFS_I(inode)->getattr_mask = STATX_BASIC_STATS; -diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c -index bd39a998843d..5089dac02660 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c -@@ -687,8 +687,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod +@@ -687,8 +687,7 @@ static int reiserfs_create(struct inode reiserfs_update_inode_transaction(inode); reiserfs_update_inode_transaction(dir); @@ -378,7 +340,7 @@ index bd39a998843d..5089dac02660 100644 retval = journal_end(&th); out_failed: -@@ -771,8 +770,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode +@@ -771,8 +770,7 @@ static int reiserfs_mknod(struct inode * goto out_failed; } @@ -388,7 +350,7 @@ index bd39a998843d..5089dac02660 100644 retval = journal_end(&th); out_failed: -@@ -871,8 +869,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode +@@ -871,8 +869,7 @@ static int reiserfs_mkdir(struct inode * /* the above add_entry did not update dir's stat data */ reiserfs_update_sd(&th, dir); @@ -398,7 +360,7 @@ index bd39a998843d..5089dac02660 100644 retval = journal_end(&th); out_failed: reiserfs_write_unlock(dir->i_sb); -@@ -1187,8 +1184,7 @@ static int reiserfs_symlink(struct inode *parent_dir, +@@ -1186,8 +1183,7 @@ static int reiserfs_symlink(struct inode goto out_failed; } @@ -408,11 +370,9 @@ index bd39a998843d..5089dac02660 100644 retval = journal_end(&th); out_failed: reiserfs_write_unlock(parent_dir->i_sb); -diff --git a/fs/udf/namei.c b/fs/udf/namei.c -index 0458dd47e105..c586026508db 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c -@@ -622,8 +622,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode) +@@ -611,8 +611,7 @@ static int udf_add_nondir(struct dentry if (fibh.sbh != fibh.ebh) brelse(fibh.ebh); brelse(fibh.sbh); @@ -422,9 +382,9 @@ index 0458dd47e105..c586026508db 100644 return 0; } -@@ -733,8 +732,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) +@@ -722,8 +721,7 @@ static int udf_mkdir(struct inode *dir, inc_nlink(dir); - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); mark_inode_dirty(dir); - unlock_new_inode(inode); - d_instantiate(dentry, inode); @@ -432,11 +392,9 @@ index 0458dd47e105..c586026508db 100644 if (fibh.sbh != fibh.ebh) brelse(fibh.ebh); brelse(fibh.sbh); -diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c -index 32545cd00ceb..d5f43ba76c59 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c -@@ -39,8 +39,7 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) +@@ -38,8 +38,7 @@ static inline int ufs_add_nondir(struct { int err = ufs_add_link(dentry, inode); if (!err) { @@ -446,7 +404,7 @@ index 32545cd00ceb..d5f43ba76c59 100644 return 0; } inode_dec_link_count(inode); -@@ -193,8 +192,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) +@@ -191,8 +190,7 @@ static int ufs_mkdir(struct inode * dir, if (err) goto out_fail; @@ -456,15 +414,13 @@ index 32545cd00ceb..d5f43ba76c59 100644 return 0; out_fail: -diff --git a/include/linux/dcache.h b/include/linux/dcache.h -index 94acbde17bb1..66c6e17e61e5 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h -@@ -224,6 +224,7 @@ extern seqlock_t rename_lock; +@@ -236,6 +236,7 @@ extern seqlock_t rename_lock; * These are the low-level FS interfaces to the dcache.. */ extern void d_instantiate(struct dentry *, struct inode *); +extern void d_instantiate_new(struct dentry *, struct inode *); extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); - extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); extern int d_instantiate_no_diralias(struct dentry *, struct inode *); + extern void __d_drop(struct dentry *dentry);