cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [bug report] GFS2: Withdraw for IO errors writing to the journal or statfs
@ 2017-08-24 11:03 Dan Carpenter
  2017-08-24 12:23 ` Andrew Price
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-08-24 11:03 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hello Bob Peterson,

The patch 9bfef7554e20: "GFS2: Withdraw for IO errors writing to the
journal or statfs" from Aug 16, 2017, leads to the following static
checker warning:

	fs/gfs2/super.c:949 gfs2_sync_fs()
	error: we previously assumed 'sdp' could be null (see line 947)

fs/gfs2/super.c
   942  static int gfs2_sync_fs(struct super_block *sb, int wait)
   943  {
   944          struct gfs2_sbd *sdp = sb->s_fs_info;
   945  
   946          gfs2_quota_sync(sb, -1);
   947          if (wait && sdp)
                            ^^^
Existing code checks for NULL.

   948                  gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
   949          return sdp->sd_log_error;
                       ^^^^^^^^^^^^^^^^^
Patch adds unchecked dereference.

   950  }

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] [bug report] GFS2: Withdraw for IO errors writing to the journal or statfs
  2017-08-24 11:03 [Cluster-devel] [bug report] GFS2: Withdraw for IO errors writing to the journal or statfs Dan Carpenter
@ 2017-08-24 12:23 ` Andrew Price
  2017-08-25 16:06   ` Bob Peterson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Price @ 2017-08-24 12:23 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thu, Aug 24, 2017 at 02:03:57PM +0300, Dan Carpenter wrote:
> Hello Bob Peterson,
> 
> The patch 9bfef7554e20: "GFS2: Withdraw for IO errors writing to the
> journal or statfs" from Aug 16, 2017, leads to the following static
> checker warning:
> 
> 	fs/gfs2/super.c:949 gfs2_sync_fs()
> 	error: we previously assumed 'sdp' could be null (see line 947)
> 
> fs/gfs2/super.c
>    942  static int gfs2_sync_fs(struct super_block *sb, int wait)
>    943  {
>    944          struct gfs2_sbd *sdp = sb->s_fs_info;
>    945  
>    946          gfs2_quota_sync(sb, -1);
>    947          if (wait && sdp)
>                             ^^^
> Existing code checks for NULL.

The NULL check seemed odd to me, and other ->sync_fs implementations don't check it, but digging through the history there's a reason it was added (see 9171f5a ). That said, I can't see the quota_off code path that it was guarding against any more, so perhaps it is no longer required.

Andy

> 
>    948                  gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
>    949          return sdp->sd_log_error;
>                        ^^^^^^^^^^^^^^^^^
> Patch adds unchecked dereference.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] [bug report] GFS2: Withdraw for IO errors writing to the journal or statfs
  2017-08-24 12:23 ` Andrew Price
@ 2017-08-25 16:06   ` Bob Peterson
  0 siblings, 0 replies; 3+ messages in thread
From: Bob Peterson @ 2017-08-25 16:06 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
| On Thu, Aug 24, 2017 at 02:03:57PM +0300, Dan Carpenter wrote:
| > Hello Bob Peterson,
| > 
| > The patch 9bfef7554e20: "GFS2: Withdraw for IO errors writing to the
| > journal or statfs" from Aug 16, 2017, leads to the following static
| > checker warning:
| > 
| > 	fs/gfs2/super.c:949 gfs2_sync_fs()
| > 	error: we previously assumed 'sdp' could be null (see line 947)
| > 
| > fs/gfs2/super.c
| >    942  static int gfs2_sync_fs(struct super_block *sb, int wait)
| >    943  {
| >    944          struct gfs2_sbd *sdp = sb->s_fs_info;
| >    945
| >    946          gfs2_quota_sync(sb, -1);
| >    947          if (wait && sdp)
| >                             ^^^
| > Existing code checks for NULL.
| 
| The NULL check seemed odd to me, and other ->sync_fs implementations don't
| check it, but digging through the history there's a reason it was added (see
| 9171f5a ). That said, I can't see the quota_off code path that it was
| guarding against any more, so perhaps it is no longer required.
| 
| Andy
| 
| > 
| >    948                  gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
| >    949          return sdp->sd_log_error;
| >                        ^^^^^^^^^^^^^^^^^
| > Patch adds unchecked dereference.
| 
Hi Andy (and Dan),

You're right. I did some research and this check for "&& sdp" seems completely
unnecessary now. In fact, I took it out and tried to recreate the problem
for which it was added (mounting with an invalid lock protocol) and it did
not recreate.

Therefore, I removed the offending check and did a force-push back to for-next.
Thanks; well spotted.

Regards,

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-25 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 11:03 [Cluster-devel] [bug report] GFS2: Withdraw for IO errors writing to the journal or statfs Dan Carpenter
2017-08-24 12:23 ` Andrew Price
2017-08-25 16:06   ` Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).