]> git.baikalelectronics.ru Git - kernel.git/commit
GFS2: Check rs_free with rd_rsspin protection
authorBob Peterson <rpeterso@redhat.com>
Wed, 6 Jul 2016 15:36:43 +0000 (10:36 -0500)
committerBob Peterson <rpeterso@redhat.com>
Tue, 12 Jul 2016 16:48:22 +0000 (11:48 -0500)
commit55c0187540748a1dda6c1aa5f45324c3857ee343
treedf0c36e3d387d2cd46b74c0f1228bc3da6fcad4e
parent6e5e494d56a3cdd23a6f4cc76a09969eb8edfc7b
GFS2: Check rs_free with rd_rsspin protection

For the last process to close a file opened for write, function
gfs2_rsqa_delete was deleting the file's inode's block reservation
out of the rgrp reservations tree. Then it was checking to make sure
rs_free was 0, but it was performing the check outside the protection
of rd_rsspin spin_lock. The rd_rsspin spin_lock protection is needed
to prevent a race between the process freeing the reservation and
another who is allocating a new set of blocks inside the same rgrp
for the same inode, thus changing its value.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/rgrp.c