Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154079
b: refs/heads/master
c: 692684e
h: refs/heads/master
i:
  154077: 2856324
  154075: f272792
  154071: 45f77f5
  154063: 44c3ca4
  154047: 8b2685f
v: v3
  • Loading branch information
Sunil Mushran authored and Joel Becker committed Jun 22, 2009
1 parent 4f1a5a8 commit 236a767
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3d38840abaa45c1c5a5fabbb8ffc9a0d1a764d1
refs/heads/master: 692684e19e317a374c18e70a44d6413e51f71c11
14 changes: 12 additions & 2 deletions trunk/fs/ocfs2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,13 +1880,20 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)

os = &osb->osb_orphan_scan;

if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE)
goto out;

status = ocfs2_orphan_scan_lock(osb, &seqno, DLM_LOCK_EX);
if (status < 0) {
if (status != -EAGAIN)
mlog_errno(status);
goto out;
}

/* Do no queue the tasks if the volume is being umounted */
if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE)
goto unlock;

if (os->os_seqno != seqno) {
os->os_seqno = seqno;
goto unlock;
Expand Down Expand Up @@ -1920,8 +1927,9 @@ void ocfs2_orphan_scan_work(struct work_struct *work)

mutex_lock(&os->os_lock);
ocfs2_queue_orphan_scan(osb);
schedule_delayed_work(&os->os_orphan_scan_work,
ocfs2_orphan_scan_timeout());
if (atomic_read(&os->os_state) == ORPHAN_SCAN_ACTIVE)
schedule_delayed_work(&os->os_orphan_scan_work,
ocfs2_orphan_scan_timeout());
mutex_unlock(&os->os_lock);
}

Expand All @@ -1930,6 +1938,7 @@ void ocfs2_orphan_scan_stop(struct ocfs2_super *osb)
struct ocfs2_orphan_scan *os;

os = &osb->osb_orphan_scan;
atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE);
mutex_lock(&os->os_lock);
cancel_delayed_work(&os->os_orphan_scan_work);
mutex_unlock(&os->os_lock);
Expand All @@ -1940,6 +1949,7 @@ int ocfs2_orphan_scan_init(struct ocfs2_super *osb)
struct ocfs2_orphan_scan *os;

os = &osb->osb_orphan_scan;
atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE);
os->os_osb = osb;
os->os_count = 0;
os->os_scantime = CURRENT_TIME;
Expand Down
6 changes: 6 additions & 0 deletions trunk/fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ struct ocfs2_lock_res {
#endif
};

enum ocfs2_orphan_scan_state {
ORPHAN_SCAN_ACTIVE,
ORPHAN_SCAN_INACTIVE
};

struct ocfs2_orphan_scan {
struct mutex os_lock;
struct ocfs2_super *os_osb;
Expand All @@ -162,6 +167,7 @@ struct ocfs2_orphan_scan {
struct timespec os_scantime; /* time this node ran the scan */
u32 os_count; /* tracks node specific scans */
u32 os_seqno; /* tracks cluster wide scans */
atomic_t os_state; /* ACTIVE or INACTIVE */
};

struct ocfs2_dlm_debug {
Expand Down
5 changes: 3 additions & 2 deletions trunk/fs/ocfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,14 +1814,15 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)

debugfs_remove(osb->osb_ctxt);

/* Orphan scan should be stopped as early as possible */
ocfs2_orphan_scan_stop(osb);

ocfs2_disable_quotas(osb);

ocfs2_shutdown_local_alloc(osb);

ocfs2_truncate_log_shutdown(osb);

ocfs2_orphan_scan_stop(osb);

/* This will disable recovery and flush any recovery work. */
ocfs2_recovery_exit(osb);

Expand Down

0 comments on commit 236a767

Please sign in to comment.