From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [bug report] [GFS2] The core of GFS2
Date: Wed, 11 Jul 2018 13:35:20 +0100 [thread overview]
Message-ID: <982f3fc6-3332-7c19-cde9-092a12e77ccd@redhat.com> (raw)
In-Reply-To: <20180711121846.7uhurq5egorpfg6n@kili.mountain>
Hi,
On 11/07/18 13:18, Dan Carpenter wrote:
> Hello David Teigland,
>
> The patch b3b94faa5fe5: "[GFS2] The core of GFS2" from Jan 16, 2006,
> leads to the following static checker warning:
>
> fs/gfs2/dir.c:1104 dir_split_leaf()
> warn: 'new' can also be NULL
>
> fs/gfs2/dir.c
> 1083 /* Copy the entries */
> 1084 dent = (struct gfs2_dirent *)(obh->b_data + sizeof(struct gfs2_leaf));
> 1085
> 1086 do {
> 1087 next = dent;
> 1088 if (dirent_next(dip, obh, &next))
> 1089 next = NULL;
> 1090
> 1091 if (!gfs2_dirent_sentinel(dent) &&
> 1092 be32_to_cpu(dent->de_hash) < divider) {
> 1093 struct qstr str;
> 1094 void *ptr = ((char *)dent - obh->b_data) + nbh->b_data;
> 1095 str.name = (char*)(dent+1);
> 1096 str.len = be16_to_cpu(dent->de_name_len);
> 1097 str.hash = be32_to_cpu(dent->de_hash);
> 1098 new = gfs2_dirent_split_alloc(inode, nbh, &str, ptr);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This returns both NULL and error pointers. There is no documentation
> so I have no idea what the the returns mean.
That can only happen in case the gfs2_dirent_scan does not find any free
space. Since the leaf block has been split immediately before we run
gfs2_dirent_scan, it can only happen if something has come along and
stomped on the newly split leaf block, which should be impossible, so it
looks like a false positive to me,
Steve.
>
> 1099 if (IS_ERR(new)) {
> 1100 error = PTR_ERR(new);
> 1101 break;
> 1102 }
> 1103
> 1104 new->de_inum = dent->de_inum; /* No endian worries */
> 1105 new->de_type = dent->de_type; /* No endian worries */
> 1106 be16_add_cpu(&nleaf->lf_entries, 1);
> 1107
> 1108 dirent_del(dip, obh, prev, dent);
> 1109
> 1110 if (!oleaf->lf_entries)
> 1111 gfs2_consist_inode(dip);
> 1112 be16_add_cpu(&oleaf->lf_entries, -1);
> 1113
> 1114 if (!prev)
> 1115 prev = dent;
> 1116
> 1117 moved = 1;
> 1118 } else {
> 1119 prev = dent;
> 1120 }
> 1121 dent = next;
> 1122 } while (dent);
> 1123
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2018-07-11 12:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 12:18 [Cluster-devel] [bug report] [GFS2] The core of GFS2 Dan Carpenter
2018-07-11 12:35 ` Steven Whitehouse [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=982f3fc6-3332-7c19-cde9-092a12e77ccd@redhat.com \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).