{
struct datablock *db;
struct list_head done;
+ long timeout = MAX_SCHEDULE_TIMEOUT;
+
if (list_empty_careful(&fs->pending_orphans))
return MAX_SCHEDULE_TIMEOUT;
mx = orphan_mutex(db);
if (!mx && !test_bit(B_Claimed, &db->b.flags))
/* OK not to have a mutex */;
- else if (!mx || !mutex_trylock(mx))
+ else if (!mx || !mutex_trylock(mx)) {
+ /* we cannot get a wakeup when mutex
+ * is unlocked, so we need timeout
+ * FIXME this is unfortunate
+ */
+ timeout = msecs_to_jiffies(500);
continue;
+ }
getdref(db, MKREF(run_orphans));
spin_unlock(&fs->lock);
if (list_empty_careful(&fs->pending_orphans))
/* unmount might be waiting... */
wake_up(&fs->async_complete);
- return MAX_SCHEDULE_TIMEOUT;
+ return timeout;
}
int lafs_drop_orphan(struct fs *fs, struct datablock *db)