Commit 789f95b7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-v3.6-rc7' of git://oss.sgi.com/xfs/xfs

Pull xfs bugfixes from Ben Myers:
 - fix a regression related to xfs_sync_worker racing with unmount.
 - fix a race while discarding xfs buffers.

* tag 'for-linus-v3.6-rc7' of git://oss.sgi.com/xfs/xfs:
  xfs: stop the sync worker before xfs_unmountfs
  xfs: fix race while discarding buffers [V4]
parents 36a21fe6 0ba6e536
...@@ -96,6 +96,7 @@ xfs_buf_lru_add( ...@@ -96,6 +96,7 @@ xfs_buf_lru_add(
atomic_inc(&bp->b_hold); atomic_inc(&bp->b_hold);
list_add_tail(&bp->b_lru, &btp->bt_lru); list_add_tail(&bp->b_lru, &btp->bt_lru);
btp->bt_lru_nr++; btp->bt_lru_nr++;
bp->b_lru_flags &= ~_XBF_LRU_DISPOSE;
} }
spin_unlock(&btp->bt_lru_lock); spin_unlock(&btp->bt_lru_lock);
} }
...@@ -154,7 +155,8 @@ xfs_buf_stale( ...@@ -154,7 +155,8 @@ xfs_buf_stale(
struct xfs_buftarg *btp = bp->b_target; struct xfs_buftarg *btp = bp->b_target;
spin_lock(&btp->bt_lru_lock); spin_lock(&btp->bt_lru_lock);
if (!list_empty(&bp->b_lru)) { if (!list_empty(&bp->b_lru) &&
!(bp->b_lru_flags & _XBF_LRU_DISPOSE)) {
list_del_init(&bp->b_lru); list_del_init(&bp->b_lru);
btp->bt_lru_nr--; btp->bt_lru_nr--;
atomic_dec(&bp->b_hold); atomic_dec(&bp->b_hold);
...@@ -1501,6 +1503,7 @@ xfs_buftarg_shrink( ...@@ -1501,6 +1503,7 @@ xfs_buftarg_shrink(
*/ */
list_move(&bp->b_lru, &dispose); list_move(&bp->b_lru, &dispose);
btp->bt_lru_nr--; btp->bt_lru_nr--;
bp->b_lru_flags |= _XBF_LRU_DISPOSE;
} }
spin_unlock(&btp->bt_lru_lock); spin_unlock(&btp->bt_lru_lock);
......
...@@ -59,6 +59,7 @@ typedef enum { ...@@ -59,6 +59,7 @@ typedef enum {
#define _XBF_KMEM (1 << 21)/* backed by heap memory */ #define _XBF_KMEM (1 << 21)/* backed by heap memory */
#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */ #define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */
#define _XBF_COMPOUND (1 << 23)/* compound buffer */ #define _XBF_COMPOUND (1 << 23)/* compound buffer */
#define _XBF_LRU_DISPOSE (1 << 24)/* buffer being discarded */
typedef unsigned int xfs_buf_flags_t; typedef unsigned int xfs_buf_flags_t;
...@@ -77,7 +78,8 @@ typedef unsigned int xfs_buf_flags_t; ...@@ -77,7 +78,8 @@ typedef unsigned int xfs_buf_flags_t;
{ _XBF_PAGES, "PAGES" }, \ { _XBF_PAGES, "PAGES" }, \
{ _XBF_KMEM, "KMEM" }, \ { _XBF_KMEM, "KMEM" }, \
{ _XBF_DELWRI_Q, "DELWRI_Q" }, \ { _XBF_DELWRI_Q, "DELWRI_Q" }, \
{ _XBF_COMPOUND, "COMPOUND" } { _XBF_COMPOUND, "COMPOUND" }, \
{ _XBF_LRU_DISPOSE, "LRU_DISPOSE" }
typedef struct xfs_buftarg { typedef struct xfs_buftarg {
dev_t bt_dev; dev_t bt_dev;
...@@ -124,7 +126,12 @@ typedef struct xfs_buf { ...@@ -124,7 +126,12 @@ typedef struct xfs_buf {
xfs_buf_flags_t b_flags; /* status flags */ xfs_buf_flags_t b_flags; /* status flags */
struct semaphore b_sema; /* semaphore for lockables */ struct semaphore b_sema; /* semaphore for lockables */
/*
* concurrent access to b_lru and b_lru_flags are protected by
* bt_lru_lock and not by b_sema
*/
struct list_head b_lru; /* lru list */ struct list_head b_lru; /* lru list */
xfs_buf_flags_t b_lru_flags; /* internal lru status flags */
wait_queue_head_t b_waiters; /* unpin waiters */ wait_queue_head_t b_waiters; /* unpin waiters */
struct list_head b_list; struct list_head b_list;
struct xfs_perag *b_pag; /* contains rbtree root */ struct xfs_perag *b_pag; /* contains rbtree root */
......
...@@ -919,6 +919,7 @@ xfs_fs_put_super( ...@@ -919,6 +919,7 @@ xfs_fs_put_super(
struct xfs_mount *mp = XFS_M(sb); struct xfs_mount *mp = XFS_M(sb);
xfs_filestream_unmount(mp); xfs_filestream_unmount(mp);
cancel_delayed_work_sync(&mp->m_sync_work);
xfs_unmountfs(mp); xfs_unmountfs(mp);
xfs_syncd_stop(mp); xfs_syncd_stop(mp);
xfs_freesb(mp); xfs_freesb(mp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment