[LU-17295] avoiding VFS exclusive locking on shared parent directory in ->atomic_open() Created: 17/Nov/23  Updated: 18/Dec/23

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Qian Yingjin Assignee: Qian Yingjin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

This is an experimental feature to avoid the VFS exclusive locking on parent directory in ->atomic_open during file creations.

It converted the exclusive semaphore mutex into a shared lock to avoid waiting for the heavy creation RPC to finished 



 Comments   
Comment by Qian Yingjin [ 17/Nov/23 ]

Found a possible bug in Lustre:

 

        static int ll_atomic_open()
        /* VFS has locked the inode before calling this */
        ll_set_inode_lock_owner(dir); 

As the dir maybe lock in shared mode, we may wrongly thought that the @dir is locked in exclusive mode:

 

        if (open_flag & O_CREAT)
		inode_lock(dir->d_inode);
	else
		inode_lock_shared(dir->d_inode);
	error = lookup_open(nd, &path, file, op, got_write);
	if (open_flag & O_CREAT)
		inode_unlock(dir->d_inode);
	else
		inode_unlock_shared(dir->d_inode);

 

in vvp_inode_ops(),

we may unlock the inode wrongly...

 

case COIO_INODE_UNLOCK:
        if (ll_get_inode_lock_owner(inode) == current)
               ll_inode_unlock(inode); 

 

 

 

Comment by Gerrit Updater [ 17/Nov/23 ]

"Qian Yingjin <qian@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53169
Subject: LU-17295 llite: avoid VFS exclusive locking in atomic_open
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a5d02885d5eaacaefc10c7962056587b74199daf

Generated at Sat Feb 10 03:34:15 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.