Commit "gfs2: Use GL_NOBLOCK flag for non-blocking lookups" has several issues, some of which are non-trivial to fix, so revert it for now: https://lore.kernel.org/gfs2/20240202050230.GA875515@ZenIV/T/ This reverts commit dd00aaeb343255a8a30de671bd27bde79a47c8e5.
Unified · Split
| @@ -32,25 +32,21 @@ · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) |
| 34 | 34 | { |
| 35 | − struct dentry *parent = NULL; | |
| 35 | + struct dentry *parent; | |
| 36 | 36 | struct gfs2_sbd *sdp; |
| 37 | 37 | struct gfs2_inode *dip; |
| 38 | − struct inode *dinode, *inode; | |
| 38 | + struct inode *inode; | |
| 39 | 39 | struct gfs2_holder d_gh; |
| 40 | 40 | struct gfs2_inode *ip = NULL; |
| 41 | 41 | int error, valid = 0; |
| 42 | 42 | int had_lock = 0; |
| 43 | 43 | |
| 44 | − if (flags & LOOKUP_RCU) { | |
| 45 | − dinode = d_inode_rcu(READ_ONCE(dentry->d_parent)); | |
| 46 | − if (!dinode) | |
| 47 | − return -ECHILD; | |
| 48 | − } else { | |
| 49 | − parent = dget_parent(dentry); | |
| 50 | − dinode = d_inode(parent); | |
| 51 | − } | |
| 52 | − sdp = GFS2_SB(dinode); | |
| 53 | − dip = GFS2_I(dinode); | |
| 44 | + if (flags & LOOKUP_RCU) | |
| 45 | + return -ECHILD; | |
| 46 | + | |
| 47 | + parent = dget_parent(dentry); | |
| 48 | + sdp = GFS2_SB(d_inode(parent)); | |
| 49 | + dip = GFS2_I(d_inode(parent)); | |
| 54 | 50 | inode = d_inode(dentry); |
| 55 | 51 | |
| 56 | 52 | if (inode) { |
| @@ -66,8 +62,7 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) · 9 unmodified lines | ||
| 66 | 62 | |
| 67 | 63 | had_lock = (gfs2_glock_is_locked_by_me(dip->i_gl) != NULL); |
| 68 | 64 | if (!had_lock) { |
| 69 | − error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, | |
| 70 | − flags & LOOKUP_RCU ? GL_NOBLOCK : 0, &d_gh); | |
| 65 | + error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); | |
| 71 | 66 | if (error) |
| 72 | 67 | goto out; |
| 73 | 68 | } |
| @@ -1882,10 +1882,10 @@ int gfs2_permission(struct mnt_idmap *idmap, struct inode *inode, · 1881 unmodified lines | ||
| 1882 | 1882 | WARN_ON_ONCE(!may_not_block); |
| 1883 | 1883 | return -ECHILD; |
| 1884 | 1884 | } |
| 1885 | − if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) { | |
| 1886 | − int noblock = may_not_block ? GL_NOBLOCK : 0; | |
| 1887 | − error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, | |
| 1888 | − LM_FLAG_ANY | noblock, &i_gh); | |
| 1885 | + if (gfs2_glock_is_locked_by_me(gl) == NULL) { | |
| 1886 | + if (may_not_block) | |
| 1887 | + return -ECHILD; | |
| 1888 | + error = gfs2_glock_nq_init(gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); | |
| 1889 | 1889 | if (error) |
| 1890 | 1890 | return error; |
| 1891 | 1891 | } |