Skip to contentSkip to conversation

gfs2: Force withdraw to replay journals and wait for it to finish

Cluster-devel Dan Carpenter 2 participants 2 messages Feb 27, 2020

lore
Share & tools
lore
#0 lore raw

Hello Bob Peterson,

This is a semi-automatic email about new static checker warnings.

The patch f4e8da521747: "gfs2: Force withdraw to replay journals and wait for it to finish" from Jan 28, 2020, leads to the following Smatch complaint:

    fs/gfs2/util.c:135 signal_our_withdraw()
     error: we previously assumed 'sdp->sd_vfs' could be null (see line 119)

fs/gfs2/util.c
118 clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
119 if (sdp->sd_vfs && !sb_rdonly(sdp->sd_vfs))

                    ^^^^^^^^^^^

Patch adds check

120 ret = gfs2_make_fs_ro(sdp);
121
122 /*
123 * Drop the glock for our journal so another node can recover it.
124 */
125 if (gfs2_holder_initialized(&sdp->sd_journal_gh)) {
126 gfs2_glock_dq_wait(&sdp->sd_journal_gh);
127 gfs2_holder_uninit(&sdp->sd_journal_gh);
128 }
129 sdp->sd_jinode_gh.gh_flags |= GL_NOCACHE;
130 gfs2_glock_dq(&sdp->sd_jinode_gh);
131 if (test_bit(SDF_FS_FROZEN, &sdp->sd_flags)) {
132 /* Make sure gfs2_unfreeze works if partially-frozen */
133 flush_workqueue(gfs2_freeze_wq);
134 atomic_set(&sdp->sd_freeze_state, SFS_FROZEN);

   135			thaw_super(sdp->sd_vfs);
                        ^^^^^^^^^^^^^^^^^^^^^^^

And unchecked dereference as well inside the thaw_super() function.

   136		} else {
   137			wait_on_bit(&gl->gl_flags, GLF_DEMOTE, TASK_UNINTERRUPTIBLE);

regards,
dan carpenter

#1 lore raw

----- Original Message -----

Quoted 34 lines

Hello Bob Peterson,

This is a semi-automatic email about new static checker warnings.

The patch f4e8da521747: "gfs2: Force withdraw to replay journals and wait for it to finish" from Jan 28, 2020, leads to the following Smatch complaint:

    fs/gfs2/util.c:135 signal_our_withdraw()
     error: we previously assumed 'sdp->sd_vfs' could be null (see line 119)

fs/gfs2/util.c

   118		clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
   119		if (sdp->sd_vfs && !sb_rdonly(sdp->sd_vfs))
                    ^^^^^^^^^^^

Patch adds check

   120			ret = gfs2_make_fs_ro(sdp);
   121
   122		/*
   123		 * Drop the glock for our journal so another node can recover it.
   124		 */
   125		if (gfs2_holder_initialized(&sdp->sd_journal_gh)) {
   126			gfs2_glock_dq_wait(&sdp->sd_journal_gh);
   127			gfs2_holder_uninit(&sdp->sd_journal_gh);
   128		}
   129		sdp->sd_jinode_gh.gh_flags |= GL_NOCACHE;
   130		gfs2_glock_dq(&sdp->sd_jinode_gh);
   131		if (test_bit(SDF_FS_FROZEN, &sdp->sd_flags)) {
   132			/* Make sure gfs2_unfreeze works if partially-frozen */
   133			flush_workqueue(gfs2_freeze_wq);
   134			atomic_set(&sdp->sd_freeze_state, SFS_FROZEN);
   135			thaw_super(sdp->sd_vfs);
                        ^^^^^^^^^^^^^^^^^^^^^^^
Quoted 7 lines

And unchecked dereference as well inside the thaw_super() function.

   136		} else {
   137			wait_on_bit(&gl->gl_flags, GLF_DEMOTE, TASK_UNINTERRUPTIBLE);

regards,
dan carpenter

Hi,

Thanks. I fixed it.

Bob Peterson