Commit 001e8e8d authored by Steven Whitehouse's avatar Steven Whitehouse

GFS2: Don't try to deallocate unlinked inodes when mounted ro

This adds a couple of missing tests to avoid read-only nodes
from attempting to deallocate unlinked inodes.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
Reported-by: default avatarMichel Andre de la Porte <madelaporte@ubi.com>
parent 0ee53206
...@@ -385,6 +385,10 @@ static int trans_go_demote_ok(const struct gfs2_glock *gl) ...@@ -385,6 +385,10 @@ static int trans_go_demote_ok(const struct gfs2_glock *gl)
static void iopen_go_callback(struct gfs2_glock *gl) static void iopen_go_callback(struct gfs2_glock *gl)
{ {
struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object;
struct gfs2_sbd *sdp = gl->gl_sbd;
if (sdp->sd_vfs->s_flags & MS_RDONLY)
return;
if (gl->gl_demote_state == LM_ST_UNLOCKED && if (gl->gl_demote_state == LM_ST_UNLOCKED &&
gl->gl_state == LM_ST_SHARED && ip) { gl->gl_state == LM_ST_SHARED && ip) {
......
...@@ -1318,12 +1318,13 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) ...@@ -1318,12 +1318,13 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
static void gfs2_evict_inode(struct inode *inode) static void gfs2_evict_inode(struct inode *inode)
{ {
struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; struct super_block *sb = inode->i_sb;
struct gfs2_sbd *sdp = sb->s_fs_info;
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh; struct gfs2_holder gh;
int error; int error;
if (inode->i_nlink) if (inode->i_nlink || (sb->s_flags & MS_RDONLY))
goto out; goto out;
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment