Skip to content

Commit ff175a4

Browse files
mjguzikbrauner
authored andcommitted
overlayfs: use the new ->i_state accessors
Change generated with coccinelle and fixed up by hand as appropriate. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 40a4c51 commit ff175a4

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

fs/overlayfs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev,
686686
goto out_drop_write;
687687

688688
spin_lock(&inode->i_lock);
689-
inode->i_state |= I_CREATING;
689+
inode_state_set(inode, I_CREATING);
690690
spin_unlock(&inode->i_lock);
691691

692692
inode_init_owner(&nop_mnt_idmap, inode, dentry->d_parent->d_inode, mode);

fs/overlayfs/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ struct inode *ovl_get_trap_inode(struct super_block *sb, struct dentry *dir)
11491149
if (!trap)
11501150
return ERR_PTR(-ENOMEM);
11511151

1152-
if (!(trap->i_state & I_NEW)) {
1152+
if (!(inode_state_read_once(trap) & I_NEW)) {
11531153
/* Conflicting layer roots? */
11541154
iput(trap);
11551155
return ERR_PTR(-ELOOP);
@@ -1240,7 +1240,7 @@ struct inode *ovl_get_inode(struct super_block *sb,
12401240
inode = ovl_iget5(sb, oip->newinode, key);
12411241
if (!inode)
12421242
goto out_err;
1243-
if (!(inode->i_state & I_NEW)) {
1243+
if (!(inode_state_read_once(inode) & I_NEW)) {
12441244
/*
12451245
* Verify that the underlying files stored in the inode
12461246
* match those in the dentry.
@@ -1300,7 +1300,7 @@ struct inode *ovl_get_inode(struct super_block *sb,
13001300
if (upperdentry)
13011301
ovl_check_protattr(inode, upperdentry);
13021302

1303-
if (inode->i_state & I_NEW)
1303+
if (inode_state_read_once(inode) & I_NEW)
13041304
unlock_new_inode(inode);
13051305
out:
13061306
return inode;

fs/overlayfs/util.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,8 @@ bool ovl_inuse_trylock(struct dentry *dentry)
10191019
bool locked = false;
10201020

10211021
spin_lock(&inode->i_lock);
1022-
if (!(inode->i_state & I_OVL_INUSE)) {
1023-
inode->i_state |= I_OVL_INUSE;
1022+
if (!(inode_state_read(inode) & I_OVL_INUSE)) {
1023+
inode_state_set(inode, I_OVL_INUSE);
10241024
locked = true;
10251025
}
10261026
spin_unlock(&inode->i_lock);
@@ -1034,8 +1034,8 @@ void ovl_inuse_unlock(struct dentry *dentry)
10341034
struct inode *inode = d_inode(dentry);
10351035

10361036
spin_lock(&inode->i_lock);
1037-
WARN_ON(!(inode->i_state & I_OVL_INUSE));
1038-
inode->i_state &= ~I_OVL_INUSE;
1037+
WARN_ON(!(inode_state_read(inode) & I_OVL_INUSE));
1038+
inode_state_clear(inode, I_OVL_INUSE);
10391039
spin_unlock(&inode->i_lock);
10401040
}
10411041
}
@@ -1046,7 +1046,7 @@ bool ovl_is_inuse(struct dentry *dentry)
10461046
bool inuse;
10471047

10481048
spin_lock(&inode->i_lock);
1049-
inuse = (inode->i_state & I_OVL_INUSE);
1049+
inuse = (inode_state_read(inode) & I_OVL_INUSE);
10501050
spin_unlock(&inode->i_lock);
10511051

10521052
return inuse;

0 commit comments

Comments
 (0)