aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-30 18:38:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-30 18:38:47 -0500
commit9c41180be47a6c08105894e1289182995749fc9a (patch)
treee623a0c416b3c25f9f0a277c063e985539ad33be
parent9e0600f5cf6cecfcab5046d1453a9538c054d8a7 (diff)
parent88bc0ede8d35edc969350852894dc864a2dc1859 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota & reiserfs changes from Jan Kara: - two error checking improvements for quota - remove bogus i_version increase for reiserfs * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: quota: Check for register_shrinker() failure. quota: propagate error from __dquot_initialize reiserfs: remove unneeded i_version bump
-rw-r--r--fs/quota/dquot.c22
-rw-r--r--fs/reiserfs/super.c1
2 files changed, 15 insertions, 8 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 39f1b0b0c76f..020c597ef9b6 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -941,12 +941,13 @@ static int dqinit_needed(struct inode *inode, int type)
941} 941}
942 942
943/* This routine is guarded by s_umount semaphore */ 943/* This routine is guarded by s_umount semaphore */
944static void add_dquot_ref(struct super_block *sb, int type) 944static int add_dquot_ref(struct super_block *sb, int type)
945{ 945{
946 struct inode *inode, *old_inode = NULL; 946 struct inode *inode, *old_inode = NULL;
947#ifdef CONFIG_QUOTA_DEBUG 947#ifdef CONFIG_QUOTA_DEBUG
948 int reserved = 0; 948 int reserved = 0;
949#endif 949#endif
950 int err = 0;
950 951
951 spin_lock(&sb->s_inode_list_lock); 952 spin_lock(&sb->s_inode_list_lock);
952 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 953 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
@@ -966,7 +967,11 @@ static void add_dquot_ref(struct super_block *sb, int type)
966 reserved = 1; 967 reserved = 1;
967#endif 968#endif
968 iput(old_inode); 969 iput(old_inode);
969 __dquot_initialize(inode, type); 970 err = __dquot_initialize(inode, type);
971 if (err) {
972 iput(inode);
973 goto out;
974 }
970 975
971 /* 976 /*
972 * We hold a reference to 'inode' so it couldn't have been 977 * We hold a reference to 'inode' so it couldn't have been
@@ -981,7 +986,7 @@ static void add_dquot_ref(struct super_block *sb, int type)
981 } 986 }
982 spin_unlock(&sb->s_inode_list_lock); 987 spin_unlock(&sb->s_inode_list_lock);
983 iput(old_inode); 988 iput(old_inode);
984 989out:
985#ifdef CONFIG_QUOTA_DEBUG 990#ifdef CONFIG_QUOTA_DEBUG
986 if (reserved) { 991 if (reserved) {
987 quota_error(sb, "Writes happened before quota was turned on " 992 quota_error(sb, "Writes happened before quota was turned on "
@@ -989,6 +994,7 @@ static void add_dquot_ref(struct super_block *sb, int type)
989 "Please run quotacheck(8)"); 994 "Please run quotacheck(8)");
990 } 995 }
991#endif 996#endif
997 return err;
992} 998}
993 999
994/* 1000/*
@@ -2379,10 +2385,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
2379 dqopt->flags |= dquot_state_flag(flags, type); 2385 dqopt->flags |= dquot_state_flag(flags, type);
2380 spin_unlock(&dq_state_lock); 2386 spin_unlock(&dq_state_lock);
2381 2387
2382 add_dquot_ref(sb, type); 2388 error = add_dquot_ref(sb, type);
2383 2389 if (error)
2384 return 0; 2390 dquot_disable(sb, type, flags);
2385 2391
2392 return error;
2386out_file_init: 2393out_file_init:
2387 dqopt->files[type] = NULL; 2394 dqopt->files[type] = NULL;
2388 iput(inode); 2395 iput(inode);
@@ -2985,7 +2992,8 @@ static int __init dquot_init(void)
2985 pr_info("VFS: Dquot-cache hash table entries: %ld (order %ld," 2992 pr_info("VFS: Dquot-cache hash table entries: %ld (order %ld,"
2986 " %ld bytes)\n", nr_hash, order, (PAGE_SIZE << order)); 2993 " %ld bytes)\n", nr_hash, order, (PAGE_SIZE << order));
2987 2994
2988 register_shrinker(&dqcache_shrinker); 2995 if (register_shrinker(&dqcache_shrinker))
2996 panic("Cannot register dquot shrinker");
2989 2997
2990 return 0; 2998 return 0;
2991} 2999}
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 020c9cacbb2f..1fc934d24459 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2591,7 +2591,6 @@ out:
2591 return err; 2591 return err;
2592 if (inode->i_size < off + len - towrite) 2592 if (inode->i_size < off + len - towrite)
2593 i_size_write(inode, off + len - towrite); 2593 i_size_write(inode, off + len - towrite);
2594 inode->i_version++;
2595 inode->i_mtime = inode->i_ctime = current_time(inode); 2594 inode->i_mtime = inode->i_ctime = current_time(inode);
2596 mark_inode_dirty(inode); 2595 mark_inode_dirty(inode);
2597 return len - towrite; 2596 return len - towrite;