mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
Fixed bugs and crashes that were related to inconsistent iget ( + ilookup)/iput.
This commit is contained in:
parent
44bf91e8aa
commit
4a6f7082dc
@ -149,12 +149,20 @@ nextfrag:
|
||||
dout(30, "d_alloc badness\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dn->d_inode == NULL) {
|
||||
in = new_inode(parent->d_sb);
|
||||
if (in == NULL) {
|
||||
dout(30, "new_inode badness\n");
|
||||
d_delete(dn);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
in=dn->d_inode;
|
||||
}
|
||||
|
||||
if (in->i_ino != fi->rinfo.dir_in[i].in->ino) {
|
||||
if (ceph_fill_inode(in, fi->rinfo.dir_in[i].in) < 0) {
|
||||
dout(30, "ceph_fill_inode badness\n");
|
||||
iput(in);
|
||||
@ -249,9 +257,12 @@ static struct dentry *ceph_dir_lookup(struct inode *dir, struct dentry *dentry,
|
||||
inode = iget(dir->i_sb, ino);
|
||||
if (!inode)
|
||||
return ERR_PTR(-EACCES);
|
||||
if ((err = ceph_fill_inode(inode, rinfo.trace_in[rinfo.trace_nr-1].in)) < 0)
|
||||
if ((err = ceph_fill_inode(inode, rinfo.trace_in[rinfo.trace_nr-1].in)) < 0) {
|
||||
iput(inode);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
d_add(dentry, inode);
|
||||
iput(inode);
|
||||
} else {
|
||||
dout(10, "no trace in reply? wtf.\n");
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ int ceph_open(struct inode *inode, struct file *file)
|
||||
wanted = ceph_caps_wanted(ci);
|
||||
ci->i_cap_wanted |= wanted; /* FIXME this isn't quite right */
|
||||
|
||||
dout(5, "ceph_open success, %lx %p\n", inode->i_ino, ilookup(inode->i_sb, inode->i_ino));
|
||||
dout(5, "ceph_open success, %lx\n", inode->i_ino);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -941,6 +941,8 @@ void ceph_mdsc_handle_filecaps(struct ceph_mds_client *mdsc, struct ceph_msg *ms
|
||||
dout(10, "cap export/import -- IMPLEMENT ME\n");
|
||||
break;
|
||||
}
|
||||
|
||||
iput(inode);
|
||||
|
||||
return;
|
||||
bad:
|
||||
|
@ -437,12 +437,13 @@ static int open_root_inode(struct super_block *sb, struct ceph_mount_args *args)
|
||||
reqhead->args.open.mode = 0;
|
||||
if ((err = ceph_mdsc_do_request(mdsc, req, &rinfo, -1)) < 0)
|
||||
return err;
|
||||
|
||||
inode = new_inode(sb);
|
||||
|
||||
BUG_ON(rinfo.trace_nr == 0);
|
||||
|
||||
inode = iget(sb, rinfo.trace_in[rinfo.trace_nr-1].in->ino) ;
|
||||
if (inode == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
BUG_ON(rinfo.trace_nr == 0);
|
||||
if ((err = ceph_fill_inode(inode, rinfo.trace_in[rinfo.trace_nr-1].in)) < 0)
|
||||
goto out;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user