@@ -79,6 +79,11 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
if (!trylock_super(sb))
return SHRINK_STOP;
+ if ((sb->s_flags & (SB_BORN|SB_ACTIVE)) != (SB_BORN|SB_ACTIVE)) {
+ freed = SHRINK_STOP;
+ goto unlock;
+ }
+
if (sb->s_op->nr_cached_objects)
fs_objects = sb->s_op->nr_cached_objects(sb, sc);
@@ -110,6 +115,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
freed += sb->s_op->free_cached_objects(sb, sc);
}
+unlock:
up_read(&sb->s_umount);
return freed;
}
@@ -136,7 +142,7 @@ static unsigned long super_cache_count(struct shrinker *shrink,
* avoid this situation, so do the same here. The memory barrier is
* matched with the one in mount_fs() as we don't hold locks here.
*/
- if (!(sb->s_flags & SB_BORN))
+ if ((sb->s_flags & (SB_BORN|SB_ACTIVE)) != (SB_BORN|SB_ACTIVE))
return 0;
smp_rmb();