[Cluster-devel] [GFS2 PATCH 0/3] Clean up and fix quota data allocate and free

Bob Peterson rpeterso at redhat.com
Wed Feb 26 15:48:41 UTC 2020


This patch set cleans up a recently discovered race between file close
and chown. The problem was that file close would free the quota data
structures attached to the in-core inode, but chown relied on them to
exist. So if the timing of the close is wrong, the chown can result in
kernel panic. The problem is easily recreated with this:

On terminal session 1:
while true; do chown test /mnt/gfs2/test; chown root /mnt/gfs2/test; done

On terminal session 2:
while true; do echo "a" > /mnt/gfs2/test; echo "b" > /mnt/gfs2/test;done

The first patch changes the sequence so that the quota data structure
isn't freed until evict time, rather than at close time. The other two
patches are cleanups that natually follow from the first patch.

Bob Peterson (3):
  gfs2: free quota data struct during evict, not file close
  gfs2: rename gfs2_rsqa_delete to gfs2_rs_delete
  gfs2: eliminate gfs2_rsqa_alloc in favor of gfs2_qa_alloc

 fs/gfs2/acl.c   |  3 ++-
 fs/gfs2/bmap.c  |  4 ++--
 fs/gfs2/file.c  | 10 +++++-----
 fs/gfs2/inode.c | 14 +++++++-------
 fs/gfs2/quota.c | 16 +++-------------
 fs/gfs2/quota.h |  1 -
 fs/gfs2/rgrp.c  | 15 ++-------------
 fs/gfs2/rgrp.h  |  3 +--
 fs/gfs2/super.c |  5 ++++-
 fs/gfs2/xattr.c |  2 +-
 10 files changed, 27 insertions(+), 46 deletions(-)

-- 
2.24.1




More information about the Cluster-devel mailing list