summaryrefslogtreecommitdiff
path: root/fs/romfs/internal.h
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2016-07-20 11:15:28 +1000
committerDave Chinner <david@fromorbit.com>2016-07-20 11:15:28 +1000
commit9c7504aa72b6e2104ba6dcef518c15672ec51175 (patch)
tree70e7fb3f17e4901a97a160fd1a0c256926131ac1 /fs/romfs/internal.h
parentc891c30a4dd1a236bb98630b35fc2769c5ce0d40 (diff)
xfs: track and serialize in-flight async buffers against unmount
Newly allocated XFS metadata buffers are added to the LRU once the hold count is released, which typically occurs after I/O completion. There is no other mechanism at current that tracks the existence or I/O state of a new buffer. Further, readahead I/O tends to be submitted asynchronously by nature, which means the I/O can remain in flight and actually complete long after the calling context is gone. This means that file descriptors or any other holds on the filesystem can be released, allowing the filesystem to be unmounted while I/O is still in flight. When I/O completion occurs, core data structures may have been freed, causing completion to run into invalid memory accesses and likely to panic. This problem is reproduced on XFS via directory readahead. A filesystem is mounted, a directory is opened/closed and the filesystem immediately unmounted. The open/close cycle triggers a directory readahead that if delayed long enough, runs buffer I/O completion after the unmount has completed. To address this problem, add a mechanism to track all in-flight, asynchronous buffers using per-cpu counters in the buftarg. The buffer is accounted on the first I/O submission after the current reference is acquired and unaccounted once the buffer is returned to the LRU or freed. Update xfs_wait_buftarg() to wait on all in-flight I/O before walking the LRU list. Once in-flight I/O has completed and the workqueue has drained, all new buffers should have been released onto the LRU. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/romfs/internal.h')
0 files changed, 0 insertions, 0 deletions