Re: lockdep warning in sys_swapon

From: Qais Yousef
Date: Mon Mar 23 2020 - 11:30:51 EST


On 03/23/20 15:17, Qais Yousef wrote:
> Hi
>
> I hit the following 2 warnings when running with LOCKDEP=y on arm64 platform
> (juno-r2), running on v5.6-rc6
>
> The 1st one is when I execute `swapon -a`. The 2nd one happens at boot. I have
> /dev/sda2 as my swap in /etc/fstab
>
> Note that I either hit 1 OR 2, but didn't hit both warnings at the same time,
> yet at least.
>
> /dev/sda2 is a usb flash drive, in case it matters somehow.

By the way, I noticed that in claim_swapfile() if we fail we don't release the
lock. Shouldn't we release the lock here?

I tried with that FWIW, but it had no effect on the warnings.


diff --git a/mm/swapfile.c b/mm/swapfile.c
index b2a2e45c9a36..0293e8c7b472 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2900,8 +2900,10 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
}

inode_lock(inode);
- if (IS_SWAPFILE(inode))
+ if (IS_SWAPFILE(inode)) {
+ inode_unlock(inode);
return -EBUSY;
+ }

return 0;
}


Thanks

--
Qais Yousef