Abhi Das 3013317795 gfs2: fix quota refresh race in do_glock()
quotad periodically syncs in-memory quotas to the ondisk quota file
and sets the QDF_REFRESH flag so that a subsequent read of a synced
quota is re-read from disk.

gfs2_quota_lock() checks for this flag and sets a 'force' bit to
force re-read from disk if requested. However, there is a race
condition here. It is possible for gfs2_quota_lock() to find the
QDF_REFRESH flag unset (i.e force=0) and quotad comes in immediately
after and syncs the relevant quota and sets the QDF_REFRESH flag.
gfs2_quota_lock() resumes with force=0 and uses the stale in-memory
quota usage values that result in miscalculations.

This patch fixes this race by moving the check for the QDF_REFRESH
flag check further out into the gfs2_quota_lock() process, i.e, in
do_glock(), under the protection of the quota glock.

Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
2015-04-08 09:31:18 -05:00
..
2014-03-19 15:16:24 +00:00
2014-03-03 13:50:12 +00:00
2008-06-27 09:39:44 +01:00
2013-06-14 11:17:15 +01:00
2013-06-03 14:20:18 -07:00
2014-05-14 10:04:34 +01:00
2011-05-10 13:12:49 +01:00
2015-01-13 10:48:57 +00:00
2015-01-13 10:48:57 +00:00
2012-01-11 09:23:05 +00:00
2009-12-16 12:16:49 -05:00