summaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.com>2015-08-20 08:50:07 -0400
committerJan Kara <jack@suse.com>2015-08-20 08:58:35 -0400
commit9181f8bf5abf4b9d59b12e878895375b84fe32ba (patch)
tree7bd54141c6086a7507d2a393c465678870cd1eed /fs/udf
parent72d4d0e48995c91ddf5d1f86612c979eca95bd06 (diff)
udf: Don't modify filesystem for read-only mounts
When read-write mount of a filesystem is requested but we find out we can mount the filesystem only in read-only mode, we still modify LVID in udf_close_lvid(). That is both unnecessary and contrary to expectation that when we fall back to read-only mount we don't modify the filesystem. Make sure we call udf_close_lvid() only if we called udf_open_lvid() so that filesystem gets modified only if we verified we are allowed to write to it. Reported-by: Karel Zak <kzak@redhat.com> Signed-off-by: Jan Kara <jack@suse.com>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/super.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index b96f190bc567..81155b9b445b 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -2070,6 +2070,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2070 struct udf_options uopt; 2070 struct udf_options uopt;
2071 struct kernel_lb_addr rootdir, fileset; 2071 struct kernel_lb_addr rootdir, fileset;
2072 struct udf_sb_info *sbi; 2072 struct udf_sb_info *sbi;
2073 bool lvid_open = false;
2073 2074
2074 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); 2075 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
2075 uopt.uid = INVALID_UID; 2076 uopt.uid = INVALID_UID;
@@ -2216,8 +2217,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2216 le16_to_cpu(ts.year), ts.month, ts.day, 2217 le16_to_cpu(ts.year), ts.month, ts.day,
2217 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); 2218 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone));
2218 } 2219 }
2219 if (!(sb->s_flags & MS_RDONLY)) 2220 if (!(sb->s_flags & MS_RDONLY)) {
2220 udf_open_lvid(sb); 2221 udf_open_lvid(sb);
2222 lvid_open = true;
2223 }
2221 2224
2222 /* Assign the root inode */ 2225 /* Assign the root inode */
2223 /* assign inodes by physical block number */ 2226 /* assign inodes by physical block number */
@@ -2248,7 +2251,7 @@ parse_options_failure:
2248 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) 2251 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
2249 unload_nls(sbi->s_nls_map); 2252 unload_nls(sbi->s_nls_map);
2250#endif 2253#endif
2251 if (!(sb->s_flags & MS_RDONLY)) 2254 if (lvid_open)
2252 udf_close_lvid(sb); 2255 udf_close_lvid(sb);
2253 brelse(sbi->s_lvid_bh); 2256 brelse(sbi->s_lvid_bh);
2254 udf_sb_free_partitions(sb); 2257 udf_sb_free_partitions(sb);