]> git.baikalelectronics.ru Git - kernel.git/commit
GFS2: Temporarily zero i_no_addr when creating a dinode
authorBob Peterson <rpeterso@redhat.com>
Thu, 16 Mar 2017 19:29:13 +0000 (15:29 -0400)
committerBob Peterson <rpeterso@redhat.com>
Thu, 16 Mar 2017 19:29:13 +0000 (15:29 -0400)
commitc25307825c3f1d0b38ac5d3e760f09f4a7774e78
treee250b4523abe878bfc06d6d10fc76697b883551b
parentcbe0fcd3b457ebb3d77a2ccbdc7e1f6007e4f4ba
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>
fs/gfs2/inode.c