@@ -78,8 +78,7 @@ static struct kmem_cache *mnt_cache __ro_after_init;
7878static DECLARE_RWSEM (namespace_sem );
7979static HLIST_HEAD (unmounted ); /* protected by namespace_sem */
8080static LIST_HEAD (ex_mountpoints ); /* protected by namespace_sem */
81- static DEFINE_RWLOCK (mnt_ns_tree_lock );
82- static seqcount_rwlock_t mnt_ns_tree_seqcount = SEQCNT_RWLOCK_ZERO (mnt_ns_tree_seqcount , & mnt_ns_tree_lock );
81+ static DEFINE_SEQLOCK (mnt_ns_tree_lock );
8382
8483static struct rb_root mnt_ns_tree = RB_ROOT ; /* protected by mnt_ns_tree_lock */
8584static LIST_HEAD (mnt_ns_list ); /* protected by mnt_ns_tree_lock */
@@ -131,14 +130,12 @@ static int mnt_ns_cmp(struct rb_node *a, const struct rb_node *b)
131130
132131static inline void mnt_ns_tree_write_lock (void )
133132{
134- write_lock (& mnt_ns_tree_lock );
135- write_seqcount_begin (& mnt_ns_tree_seqcount );
133+ write_seqlock (& mnt_ns_tree_lock );
136134}
137135
138136static inline void mnt_ns_tree_write_unlock (void )
139137{
140- write_seqcount_end (& mnt_ns_tree_seqcount );
141- write_unlock (& mnt_ns_tree_lock );
138+ write_sequnlock (& mnt_ns_tree_lock );
142139}
143140
144141static void mnt_ns_tree_add (struct mnt_namespace * ns )
@@ -163,7 +160,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns)
163160
164161static void mnt_ns_release (struct mnt_namespace * ns )
165162{
166- lockdep_assert_not_held (& mnt_ns_tree_lock );
163+ lockdep_assert_not_held (& mnt_ns_tree_lock . lock );
167164
168165 /* keep alive for {list,stat}mount() */
169166 if (refcount_dec_and_test (& ns -> passive )) {
@@ -225,11 +222,11 @@ static struct mnt_namespace *lookup_mnt_ns(u64 mnt_ns_id)
225222
226223 guard (rcu )();
227224 do {
228- seq = read_seqcount_begin ( & mnt_ns_tree_seqcount );
225+ seq = read_seqbegin ( & mnt_ns_tree_lock );
229226 node = rb_find_rcu (& mnt_ns_id , & mnt_ns_tree , mnt_ns_find );
230227 if (node )
231228 break ;
232- } while (read_seqcount_retry ( & mnt_ns_tree_seqcount , seq ));
229+ } while (read_seqretry ( & mnt_ns_tree_lock , seq ));
233230
234231 if (!node )
235232 return NULL ;
0 commit comments