Commit 3b663780 authored by Sage Weil's avatar Sage Weil

ceph: take reference on mds request r_unsafe_dir

We put ourselves on an inode list for the parent directory of metadata
operations so that an fsync on the directory will wait for metadata updates
to commit to disk.  We weren't holding a reference to that directory,
however, and under certain workloads (fsstress in this case) the directory
can go away.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 61c4f2c8
...@@ -578,6 +578,7 @@ static void __register_request(struct ceph_mds_client *mdsc, ...@@ -578,6 +578,7 @@ static void __register_request(struct ceph_mds_client *mdsc,
if (dir) { if (dir) {
struct ceph_inode_info *ci = ceph_inode(dir); struct ceph_inode_info *ci = ceph_inode(dir);
ihold(dir);
spin_lock(&ci->i_unsafe_lock); spin_lock(&ci->i_unsafe_lock);
req->r_unsafe_dir = dir; req->r_unsafe_dir = dir;
list_add_tail(&req->r_unsafe_dir_item, &ci->i_unsafe_dirops); list_add_tail(&req->r_unsafe_dir_item, &ci->i_unsafe_dirops);
...@@ -598,6 +599,9 @@ static void __unregister_request(struct ceph_mds_client *mdsc, ...@@ -598,6 +599,9 @@ static void __unregister_request(struct ceph_mds_client *mdsc,
spin_lock(&ci->i_unsafe_lock); spin_lock(&ci->i_unsafe_lock);
list_del_init(&req->r_unsafe_dir_item); list_del_init(&req->r_unsafe_dir_item);
spin_unlock(&ci->i_unsafe_lock); spin_unlock(&ci->i_unsafe_lock);
iput(req->r_unsafe_dir);
req->r_unsafe_dir = NULL;
} }
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
......
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