Commit 3f4f7824 authored by Rahul Deshmukh's avatar Rahul Deshmukh Committed by Greg Kroah-Hartman

staging: lustre: llite: Adding timed wait in ll_umount_begin

There exists timing race between umount and other
thread which will increment the reference count on
mnt e.g. getattr. If umount thread lose the race
then umount fails with EBUSY error. To avoid this
timed wait is added so that umount thread will wait
for user to decrement the mnt reference count.
Signed-off-by: default avatarRahul Deshmukh <rahul.deshmukh@seagate.com>
Signed-off-by: default avatarLokesh Nagappa Jaliminche <lokesh.jaliminche@seagate.com>
Signed-off-by: default avatarJian Yu <jian.yu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1882
Seagate-bug-id: MRP-1192
Reviewed-on: http://review.whamcloud.com/20061Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71c5eec3
......@@ -506,6 +506,7 @@ struct ll_sb_info {
*/
/* root squash */
struct root_squash_info ll_squash;
struct path ll_mnt;
__kernel_fsid_t ll_fsid;
struct kobject ll_kobj; /* sysfs object */
......
......@@ -304,6 +304,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
sb->s_magic = LL_SUPER_MAGIC;
sb->s_maxbytes = MAX_LFS_FILESIZE;
sbi->ll_namelen = osfs->os_namelen;
sbi->ll_mnt.mnt = current->fs->root.mnt;
if ((sbi->ll_flags & LL_SBI_USER_XATTR) &&
!(data->ocd_connect_flags & OBD_CONNECT_XATTR)) {
......@@ -1990,6 +1991,8 @@ void ll_umount_begin(struct super_block *sb)
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd;
struct obd_ioctl_data *ioc_data;
wait_queue_head_t waitq;
struct l_wait_info lwi;
CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
sb->s_count, atomic_read(&sb->s_active));
......@@ -2022,9 +2025,14 @@ void ll_umount_begin(struct super_block *sb)
}
/* Really, we'd like to wait until there are no requests outstanding,
* and then continue. For now, we just invalidate the requests,
* schedule() and sleep one second if needed, and hope.
* and then continue. For now, we just periodically checking for vfs
* to decrement mnt_cnt and hope to finish it within 10sec.
*/
init_waitqueue_head(&waitq);
lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(10),
cfs_time_seconds(1), NULL, NULL);
l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi);
schedule();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment