Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-6] src

Module Name:    src
Committed By:   riz
Date:           Mon Oct  1 19:55:22 UTC 2012

Modified Files:
        src/sys/ufs/ufs [netbsd-6]: ufs_quota2.c
        src/tests/fs/ffs [netbsd-6]: h_quota2_tests.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #580):
        tests/fs/ffs/h_quota2_tests.c: revision 1.4
        tests/fs/ffs/ revision 1.7
        sys/ufs/ufs/ufs_quota2.c: revision 1.35
Fix quota2 list corruption issue when defaultquotas are 0 (deny any file
and block allocation).
When quota2_check() is called with an uid not yet in the list,
getinoquota2() will call quota2_q2ealloc() to allocate a new entry for this
uid. quota2_q2ealloc() will remove an entry from the free list and
put it at the head of the corresponding hash list, and flush the block
containing the header if it's not the one also containing the allocated entry.
quota2_q2ealloc() then return the alocated entry and corresponding block
to caller (getinoquota2() here), which returns it to quota2_check().
quota2_check() then checks if the allocation can succeed, and returns and
error if not and calls brelse() on the buffer (because from his POW no
change was made to the entry), effectively discarding changes
to the entry that may have been made by quota2_q2ealloc().
Fix by always bwrite()ing the entry in quota2_q2ealloc(), and re-reading
the entry in caller.
Add test cases for the bug fixed in sys/ufs/ufs/ufs_quota2.c 1.35:
when a on-disk block/inode allocation triggers allocating a new
quota entry, the new quota entry is not in the quota2 header block,
and the allocation will later be denied, the changes to the quota block would
not be flushed to disk, leading to list corruption (detected by fsck).

To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.2.1 src/sys/ufs/ufs/ufs_quota2.c
cvs rdiff -u -r1.3 -r1.3.4.1 src/tests/fs/ffs/h_quota2_tests.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/tests/fs/ffs/

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Home | Main Index | Thread Index | Old Index