Skip to content

Commit 25f6a53

Browse files
committed
Merge tag 'jfs-4.13' of git://github.com/kleikamp/linux-shaggy
Pull JFS fixes from David Kleikamp. * tag 'jfs-4.13' of git://github.com/kleikamp/linux-shaggy: jfs: preserve i_mode if __jfs_set_acl() fails jfs: Don't clear SGID when inheriting ACLs jfs: atomically read inode size
2 parents a9d0683 + f070e5a commit 25f6a53

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

fs/jfs/acl.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
7777
switch (type) {
7878
case ACL_TYPE_ACCESS:
7979
ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
80-
if (acl) {
81-
rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
82-
if (rc)
83-
return rc;
84-
inode->i_ctime = current_time(inode);
85-
mark_inode_dirty(inode);
86-
}
8780
break;
8881
case ACL_TYPE_DEFAULT:
8982
ea_name = XATTR_NAME_POSIX_ACL_DEFAULT;
@@ -115,12 +108,27 @@ int jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
115108
{
116109
int rc;
117110
tid_t tid;
111+
int update_mode = 0;
112+
umode_t mode = inode->i_mode;
118113

119114
tid = txBegin(inode->i_sb, 0);
120115
mutex_lock(&JFS_IP(inode)->commit_mutex);
116+
if (type == ACL_TYPE_ACCESS && acl) {
117+
rc = posix_acl_update_mode(inode, &mode, &acl);
118+
if (rc)
119+
goto end_tx;
120+
update_mode = 1;
121+
}
121122
rc = __jfs_set_acl(tid, inode, type, acl);
122-
if (!rc)
123+
if (!rc) {
124+
if (update_mode) {
125+
inode->i_mode = mode;
126+
inode->i_ctime = current_time(inode);
127+
mark_inode_dirty(inode);
128+
}
123129
rc = txCommit(tid, 1, &inode, 0);
130+
}
131+
end_tx:
124132
txEnd(tid);
125133
mutex_unlock(&JFS_IP(inode)->commit_mutex);
126134
return rc;

fs/jfs/resize.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
9898
goto out;
9999
}
100100

101-
VolumeSize = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
101+
VolumeSize = i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits;
102102

103103
if (VolumeSize) {
104104
if (newLVSize > VolumeSize) {
@@ -211,7 +211,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
211211
txQuiesce(sb);
212212

213213
/* Reset size of direct inode */
214-
sbi->direct_inode->i_size = sb->s_bdev->bd_inode->i_size;
214+
sbi->direct_inode->i_size = i_size_read(sb->s_bdev->bd_inode);
215215

216216
if (sbi->mntflag & JFS_INLINELOG) {
217217
/*

fs/jfs/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
313313
}
314314
case Opt_resize_nosize:
315315
{
316-
*newLVSize = sb->s_bdev->bd_inode->i_size >>
316+
*newLVSize = i_size_read(sb->s_bdev->bd_inode) >>
317317
sb->s_blocksize_bits;
318318
if (*newLVSize == 0)
319319
pr_err("JFS: Cannot determine volume size\n");
@@ -579,7 +579,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
579579
goto out_unload;
580580
}
581581
inode->i_ino = 0;
582-
inode->i_size = sb->s_bdev->bd_inode->i_size;
582+
inode->i_size = i_size_read(sb->s_bdev->bd_inode);
583583
inode->i_mapping->a_ops = &jfs_metapage_aops;
584584
hlist_add_fake(&inode->i_hash);
585585
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);

0 commit comments

Comments
 (0)