diff options
Diffstat (limited to 'fs/fuse/dir.c')
| -rw-r--r-- | fs/fuse/dir.c | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index b7989f2ab4c4..c3eb2c46c8f1 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
| @@ -342,24 +342,6 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, | |||
| 342 | return err; | 342 | return err; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static struct dentry *fuse_materialise_dentry(struct dentry *dentry, | ||
| 346 | struct inode *inode) | ||
| 347 | { | ||
| 348 | struct dentry *newent; | ||
| 349 | |||
| 350 | if (inode && S_ISDIR(inode->i_mode)) { | ||
| 351 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
| 352 | |||
| 353 | mutex_lock(&fc->inst_mutex); | ||
| 354 | newent = d_materialise_unique(dentry, inode); | ||
| 355 | mutex_unlock(&fc->inst_mutex); | ||
| 356 | } else { | ||
| 357 | newent = d_materialise_unique(dentry, inode); | ||
| 358 | } | ||
| 359 | |||
| 360 | return newent; | ||
| 361 | } | ||
| 362 | |||
| 363 | static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | 345 | static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, |
| 364 | unsigned int flags) | 346 | unsigned int flags) |
| 365 | { | 347 | { |
| @@ -382,7 +364,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
| 382 | if (inode && get_node_id(inode) == FUSE_ROOT_ID) | 364 | if (inode && get_node_id(inode) == FUSE_ROOT_ID) |
| 383 | goto out_iput; | 365 | goto out_iput; |
| 384 | 366 | ||
| 385 | newent = fuse_materialise_dentry(entry, inode); | 367 | newent = d_materialise_unique(entry, inode); |
| 386 | err = PTR_ERR(newent); | 368 | err = PTR_ERR(newent); |
| 387 | if (IS_ERR(newent)) | 369 | if (IS_ERR(newent)) |
| 388 | goto out_err; | 370 | goto out_err; |
| @@ -601,21 +583,9 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
| 601 | } | 583 | } |
| 602 | kfree(forget); | 584 | kfree(forget); |
| 603 | 585 | ||
| 604 | if (S_ISDIR(inode->i_mode)) { | 586 | err = d_instantiate_no_diralias(entry, inode); |
| 605 | struct dentry *alias; | 587 | if (err) |
| 606 | mutex_lock(&fc->inst_mutex); | 588 | return err; |
| 607 | alias = d_find_alias(inode); | ||
| 608 | if (alias) { | ||
| 609 | /* New directory must have moved since mkdir */ | ||
| 610 | mutex_unlock(&fc->inst_mutex); | ||
| 611 | dput(alias); | ||
| 612 | iput(inode); | ||
| 613 | return -EBUSY; | ||
| 614 | } | ||
| 615 | d_instantiate(entry, inode); | ||
| 616 | mutex_unlock(&fc->inst_mutex); | ||
| 617 | } else | ||
| 618 | d_instantiate(entry, inode); | ||
| 619 | 589 | ||
| 620 | fuse_change_entry_timeout(entry, &outarg); | 590 | fuse_change_entry_timeout(entry, &outarg); |
| 621 | fuse_invalidate_attr(dir); | 591 | fuse_invalidate_attr(dir); |
| @@ -1284,7 +1254,7 @@ static int fuse_direntplus_link(struct file *file, | |||
| 1284 | if (!inode) | 1254 | if (!inode) |
| 1285 | goto out; | 1255 | goto out; |
| 1286 | 1256 | ||
| 1287 | alias = fuse_materialise_dentry(dentry, inode); | 1257 | alias = d_materialise_unique(dentry, inode); |
| 1288 | err = PTR_ERR(alias); | 1258 | err = PTR_ERR(alias); |
| 1289 | if (IS_ERR(alias)) | 1259 | if (IS_ERR(alias)) |
| 1290 | goto out; | 1260 | goto out; |
