|
@@ -161,8 +161,14 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
|
|
}
|
|
}
|
|
file->private_data = rd;
|
|
file->private_data = rd;
|
|
rd->file = file;
|
|
rd->file = file;
|
|
|
|
+ spin_lock(&HFS_I(inode)->open_dir_lock);
|
|
list_add(&rd->list, &HFS_I(inode)->open_dir_list);
|
|
list_add(&rd->list, &HFS_I(inode)->open_dir_list);
|
|
|
|
+ spin_unlock(&HFS_I(inode)->open_dir_lock);
|
|
}
|
|
}
|
|
|
|
+ /*
|
|
|
|
+ * Can be done after the list insertion; exclusion with
|
|
|
|
+ * hfs_delete_cat() is provided by directory lock.
|
|
|
|
+ */
|
|
memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
|
|
memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
|
|
out:
|
|
out:
|
|
hfs_find_exit(&fd);
|
|
hfs_find_exit(&fd);
|
|
@@ -173,9 +179,9 @@ static int hfs_dir_release(struct inode *inode, struct file *file)
|
|
{
|
|
{
|
|
struct hfs_readdir_data *rd = file->private_data;
|
|
struct hfs_readdir_data *rd = file->private_data;
|
|
if (rd) {
|
|
if (rd) {
|
|
- inode_lock(inode);
|
|
|
|
|
|
+ spin_lock(&HFS_I(inode)->open_dir_lock);
|
|
list_del(&rd->list);
|
|
list_del(&rd->list);
|
|
- inode_unlock(inode);
|
|
|
|
|
|
+ spin_unlock(&HFS_I(inode)->open_dir_lock);
|
|
kfree(rd);
|
|
kfree(rd);
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -303,7 +309,7 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|
|
|
|
|
const struct file_operations hfs_dir_operations = {
|
|
const struct file_operations hfs_dir_operations = {
|
|
.read = generic_read_dir,
|
|
.read = generic_read_dir,
|
|
- .iterate = hfs_readdir,
|
|
|
|
|
|
+ .iterate_shared = hfs_readdir,
|
|
.llseek = generic_file_llseek,
|
|
.llseek = generic_file_llseek,
|
|
.release = hfs_dir_release,
|
|
.release = hfs_dir_release,
|
|
};
|
|
};
|