Skip to content

Commit 820f9f1

Browse files
committed
fs_pin: Allow for the possibility that m_list or s_list go unused.
This is needed to support lazily umounting locked mounts. Because the entire unmounted subtree needs to stay together until there are no users with references to any part of the subtree. To support this guarantee that the fs_pin m_list and s_list nodes are initialized by initializing them in init_fs_pin allowing for the possibility that pin_insert_group does not touch them. Further use hlist_del_init in pin_remove so that there is a hlist_unhashed test before the list we attempt to update the previous list item. Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 6a46c57 commit 820f9f1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/fs_pin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ static DEFINE_SPINLOCK(pin_lock);
99
void pin_remove(struct fs_pin *pin)
1010
{
1111
spin_lock(&pin_lock);
12-
hlist_del(&pin->m_list);
13-
hlist_del(&pin->s_list);
12+
hlist_del_init(&pin->m_list);
13+
hlist_del_init(&pin->s_list);
1414
spin_unlock(&pin_lock);
1515
spin_lock_irq(&pin->wait.lock);
1616
pin->done = 1;

include/linux/fs_pin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ struct vfsmount;
1313
static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
1414
{
1515
init_waitqueue_head(&p->wait);
16+
INIT_HLIST_NODE(&p->s_list);
17+
INIT_HLIST_NODE(&p->m_list);
1618
p->kill = kill;
1719
}
1820

0 commit comments

Comments
 (0)