"Exactly what it says in the summary"... it looks like we should have an LRU list of freeable struct gfs2_quota_data elements, together with a shrinker which can manage the cached data. That should allow us to remove the call to gfs2_quota_scan from gfs2_quotad and also to be more responsive to memory pressure. This bug is just a reminder that we need to do that at some future stage.
Created attachment 327338 [details] Patch to bring back some of lock_nolock's lvb-related functionality to make broken quotas work
argh, I missed out a stray printk in the previous patch.
Created attachment 327342 [details] gfs2_quota_data shrinker first attempt patch adds reclaimable quota data to another list managed by a shrinker. This patch has not been tested yet.
Created attachment 327388 [details] removes printk from earlier lock_nolock lvb-related patch
Created attachment 327389 [details] 3 changes from previous shrinker patch 1. added a line to atomic_dec(&sdp->sd_quota_count); in gfs2_shrink_qd_memory() that was missing before when we freed a qd from both the reclaim list and the fs-specific sd_quota_list. 2. changed "(atomic_read(&qd_lru_count) / 100) * sysctl_vfs_cache_pressure" to "(atomic_read(&qd_lru_count) * sysctl_vfs_cache_pressure) / 100" to get qds if qd_lru_count < 100; 3. Added SetPageUptodate(page); to stuffed_readpage() when returning a zero-filled page when index > 0; (This fixes the -EIO, I was seeing earlier; not sure if this is the right thing to do though)
Looks qood. One question though, are we using sdp->sd_quota_spin on its own in enough places to justify keeping it? If we just used qd_lru_lock on its own, then it would be possible to reduce qd_put to something like: if (atomic_dec_and_lock()) { list_add(); atomic_inc(); spin_unlock(); } and it would also simplify the other places in the code where we've now got double locking too. I don't think there should be any other issues wrt stuffed_readpage as I think all the other uses would sequentially read a file, stopping at EOF so it shouldn't be an issue.
Created attachment 327425 [details] one change from previous patch in gfs2_quota_cleanup to avoid deadlock
Created attachment 328402 [details] Tried to reduce double locking This patch uses the lru_lock for both quota lists and sd_quota_spin for internal quota fields, bitmap and such. It reduces a bit of double locking.
Created attachment 328404 [details] Missed out a lock in the previous patch. Fixed here
This is now upstream in the -nmw git tree.
In 2.6.30