On Mon, Feb 10, 2020 at 4:11 AM Chengguang Xu <cgxu519@xxxxxxxxxxxx> wrote: > static int ovl_mmap(struct file *file, struct vm_area_struct *vma) > { > struct file *realfile = file->private_data; > const struct cred *old_cred; > + struct inode *inode = file->f_inode; > + struct ovl_copy_up_work ovl_cuw; > + DEFINE_WAIT_BIT(wait, &ovl_cuw.flags, OVL_COPY_UP_PENDING); > + wait_queue_head_t *wqh; > int ret; > > + if (vma->vm_flags & MAP_SHARED && > + ovl_copy_up_shared(file_inode(file)->i_sb)) { > + ovl_cuw.err = 0; > + ovl_cuw.flags = 0; > + ovl_cuw.dentry = file_dentry(file); > + set_bit(OVL_COPY_UP_PENDING, &ovl_cuw.flags); > + > + wqh = bit_waitqueue(&ovl_cuw.flags, OVL_COPY_UP_PENDING); > + prepare_to_wait(wqh, &wait.wq_entry, TASK_UNINTERRUPTIBLE); > + > + INIT_WORK(&ovl_cuw.work, ovl_copy_up_work_fn); > + schedule_work(&ovl_cuw.work); > + > + schedule(); > + finish_wait(wqh, &wait.wq_entry); This just hides the bad lock dependency, it does not remove it. The solution we've come up with is arguably more complex, but it does fix this properly: make overlay use its own address space operations in case of a shared map. Amir, I lost track, do you remember what's the status of this work? Thanks, Miklos