diff options
author | Bob Peterson <rpeterso@redhat.com> | 2017-03-16 15:29:13 -0400 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2017-03-16 15:29:13 -0400 |
commit | cc963a11b67b796c25c5b827b25d2bcc92ce1779 (patch) | |
tree | e250b4523abe878bfc06d6d10fc76697b883551b /fs/gfs2 | |
parent | 972b044eeca582ef173d063773e292bd9e8633d6 (diff) | |
download | linux-rpi-cc963a11b67b796c25c5b827b25d2bcc92ce1779.tar.gz linux-rpi-cc963a11b67b796c25c5b827b25d2bcc92ce1779.tar.bz2 linux-rpi-cc963a11b67b796c25c5b827b25d2bcc92ce1779.zip |
GFS2: Temporarily zero i_no_addr when creating a dinode
Before this patch i_no_addr was not initialized until after the
return from allocating its block. That meant the i_no_addr was
temporarily uninitialized storage. Ordinarily that's not a concern,
but if inplace_reserve can't find space, it can call try_rgrp_unlink
which references i_no_addr as a block to avoid. That can result in
unpredictable behavior. More importantly, the trace point in
gfs2_alloc_blocks references ip->i_no_addr before it is set, which
is misleading when reading the kernel traces. This patch makes it
look like the new dinode block was assigned in the name of inode 0
rather than a random inode that's completely unrelated.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e279c3ce27be..4f405d43a86b 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -667,6 +667,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ip->i_height = 0; ip->i_depth = 0; ip->i_entries = 0; + ip->i_no_addr = 0; /* Temporarily zero until real addr is assigned */ switch(mode & S_IFMT) { case S_IFREG: |