aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r--fs/fat/file.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 27cc1164ec36..7059928fb351 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -229,7 +229,8 @@ static int fat_free(struct inode *inode, int skip)
229 229
230void fat_truncate(struct inode *inode) 230void fat_truncate(struct inode *inode)
231{ 231{
232 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 232 struct super_block *sb = inode->i_sb;
233 struct msdos_sb_info *sbi = MSDOS_SB(sb);
233 const unsigned int cluster_size = sbi->cluster_size; 234 const unsigned int cluster_size = sbi->cluster_size;
234 int nr_clusters; 235 int nr_clusters;
235 236
@@ -242,9 +243,9 @@ void fat_truncate(struct inode *inode)
242 243
243 nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; 244 nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits;
244 245
245 lock_kernel(); 246 lock_super(sb);
246 fat_free(inode, nr_clusters); 247 fat_free(inode, nr_clusters);
247 unlock_kernel(); 248 unlock_super(sb);
248 fat_flush_inodes(inode->i_sb, inode, NULL); 249 fat_flush_inodes(inode->i_sb, inode, NULL);
249} 250}
250 251
@@ -297,12 +298,13 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
297 298
298int fat_setattr(struct dentry *dentry, struct iattr *attr) 299int fat_setattr(struct dentry *dentry, struct iattr *attr)
299{ 300{
301 struct super_block *sb = dentry->d_sb;
300 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); 302 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
301 struct inode *inode = dentry->d_inode; 303 struct inode *inode = dentry->d_inode;
302 int mask, error = 0; 304 int mask, error = 0;
303 unsigned int ia_valid; 305 unsigned int ia_valid;
304 306
305 lock_kernel(); 307 lock_super(sb);
306 308
307 /* 309 /*
308 * Expand the file. Since inode_setattr() updates ->i_size 310 * Expand the file. Since inode_setattr() updates ->i_size
@@ -356,7 +358,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
356 mask = sbi->options.fs_fmask; 358 mask = sbi->options.fs_fmask;
357 inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask); 359 inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask);
358out: 360out:
359 unlock_kernel(); 361 unlock_super(sb);
360 return error; 362 return error;
361} 363}
362EXPORT_SYMBOL_GPL(fat_setattr); 364EXPORT_SYMBOL_GPL(fat_setattr);