diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 4a3b9e6b31ad..70215a21fb20 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1880,6 +1880,9 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1880 | 1880 | ||
1881 | os = &osb->osb_orphan_scan; | 1881 | os = &osb->osb_orphan_scan; |
1882 | 1882 | ||
1883 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) | ||
1884 | goto out; | ||
1885 | |||
1883 | status = ocfs2_orphan_scan_lock(osb, &seqno, DLM_LOCK_EX); | 1886 | status = ocfs2_orphan_scan_lock(osb, &seqno, DLM_LOCK_EX); |
1884 | if (status < 0) { | 1887 | if (status < 0) { |
1885 | if (status != -EAGAIN) | 1888 | if (status != -EAGAIN) |
@@ -1887,6 +1890,10 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1887 | goto out; | 1890 | goto out; |
1888 | } | 1891 | } |
1889 | 1892 | ||
1893 | /* Do no queue the tasks if the volume is being umounted */ | ||
1894 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) | ||
1895 | goto unlock; | ||
1896 | |||
1890 | if (os->os_seqno != seqno) { | 1897 | if (os->os_seqno != seqno) { |
1891 | os->os_seqno = seqno; | 1898 | os->os_seqno = seqno; |
1892 | goto unlock; | 1899 | goto unlock; |
@@ -1920,8 +1927,9 @@ void ocfs2_orphan_scan_work(struct work_struct *work) | |||
1920 | 1927 | ||
1921 | mutex_lock(&os->os_lock); | 1928 | mutex_lock(&os->os_lock); |
1922 | ocfs2_queue_orphan_scan(osb); | 1929 | ocfs2_queue_orphan_scan(osb); |
1923 | schedule_delayed_work(&os->os_orphan_scan_work, | 1930 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_ACTIVE) |
1924 | ocfs2_orphan_scan_timeout()); | 1931 | schedule_delayed_work(&os->os_orphan_scan_work, |
1932 | ocfs2_orphan_scan_timeout()); | ||
1925 | mutex_unlock(&os->os_lock); | 1933 | mutex_unlock(&os->os_lock); |
1926 | } | 1934 | } |
1927 | 1935 | ||
@@ -1930,6 +1938,7 @@ void ocfs2_orphan_scan_stop(struct ocfs2_super *osb) | |||
1930 | struct ocfs2_orphan_scan *os; | 1938 | struct ocfs2_orphan_scan *os; |
1931 | 1939 | ||
1932 | os = &osb->osb_orphan_scan; | 1940 | os = &osb->osb_orphan_scan; |
1941 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); | ||
1933 | mutex_lock(&os->os_lock); | 1942 | mutex_lock(&os->os_lock); |
1934 | cancel_delayed_work(&os->os_orphan_scan_work); | 1943 | cancel_delayed_work(&os->os_orphan_scan_work); |
1935 | mutex_unlock(&os->os_lock); | 1944 | mutex_unlock(&os->os_lock); |
@@ -1940,6 +1949,7 @@ int ocfs2_orphan_scan_init(struct ocfs2_super *osb) | |||
1940 | struct ocfs2_orphan_scan *os; | 1949 | struct ocfs2_orphan_scan *os; |
1941 | 1950 | ||
1942 | os = &osb->osb_orphan_scan; | 1951 | os = &osb->osb_orphan_scan; |
1952 | atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE); | ||
1943 | os->os_osb = osb; | 1953 | os->os_osb = osb; |
1944 | os->os_count = 0; | 1954 | os->os_count = 0; |
1945 | os->os_scantime = CURRENT_TIME; | 1955 | os->os_scantime = CURRENT_TIME; |