]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - fs/ceph/mds_client.c
ceph: create a new session lock to avoid lock inversion
authorAlex Elder <elder@dreamhost.com>
Fri, 13 Jan 2012 01:48:10 +0000 (17:48 -0800)
committerSage Weil <sage@newdream.net>
Thu, 2 Feb 2012 20:49:19 +0000 (12:49 -0800)
commitd8fb02abdc39f92a1066313e2b17047876afa8f9
tree32f8126683dd185411b701b79d23900cf6c02035
parent32852a81bccd9e3d1953b894966393d1b546576d
ceph: create a new session lock to avoid lock inversion

Lockdep was reporting a possible circular lock dependency in
dentry_lease_is_valid().  That function needs to sample the
session's s_cap_gen and and s_cap_ttl fields coherently, but needs
to do so while holding a dentry lock.  The s_cap_lock field was
being used to protect the two fields, but that can't be taken while
holding a lock on a dentry within the session.

In most cases, the s_cap_gen and s_cap_ttl fields only get operated
on separately.  But in three cases they need to be updated together.
Implement a new lock to protect the spots updating both fields
atomically is required.

Signed-off-by: Alex Elder <elder@dreamhost.com>
Reviewed-by: Sage Weil <sage@newdream.net>
fs/ceph/caps.c
fs/ceph/dir.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h