Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45722
b: refs/heads/master
c: de14569
h: refs/heads/master
v: v3
  • Loading branch information
Vladimir Saveliev authored and Linus Torvalds committed Jan 23, 2007
1 parent af74ded commit c0325d3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30150f8d7b76f25b1127a5079528b7a17307f995
refs/heads/master: de14569f94513279e3d44d9571a421e9da1759ae
20 changes: 19 additions & 1 deletion trunk/fs/reiserfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
}

mutex_lock(&inode->i_mutex);

mutex_lock(&(REISERFS_I(inode)->i_mmap));
if (REISERFS_I(inode)->i_flags & i_ever_mapped)
REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;

reiserfs_write_lock(inode->i_sb);
/* freeing preallocation only involves relogging blocks that
* are already in the current transaction. preallocation gets
Expand Down Expand Up @@ -100,11 +105,24 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
err = reiserfs_truncate_file(inode, 0);
}
out:
mutex_unlock(&(REISERFS_I(inode)->i_mmap));
mutex_unlock(&inode->i_mutex);
reiserfs_write_unlock(inode->i_sb);
return err;
}

static int reiserfs_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode;

inode = file->f_path.dentry->d_inode;
mutex_lock(&(REISERFS_I(inode)->i_mmap));
REISERFS_I(inode)->i_flags |= i_ever_mapped;
mutex_unlock(&(REISERFS_I(inode)->i_mmap));

return generic_file_mmap(file, vma);
}

static void reiserfs_vfs_truncate_file(struct inode *inode)
{
reiserfs_truncate_file(inode, 1);
Expand Down Expand Up @@ -1527,7 +1545,7 @@ const struct file_operations reiserfs_file_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = reiserfs_compat_ioctl,
#endif
.mmap = generic_file_mmap,
.mmap = reiserfs_file_mmap,
.open = generic_file_open,
.release = reiserfs_file_release,
.fsync = reiserfs_sync_file,
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ static void init_inode(struct inode *inode, struct treepath *path)
REISERFS_I(inode)->i_prealloc_count = 0;
REISERFS_I(inode)->i_trans_id = 0;
REISERFS_I(inode)->i_jl = NULL;
mutex_init(&(REISERFS_I(inode)->i_mmap));
reiserfs_init_acl_access(inode);
reiserfs_init_acl_default(inode);
reiserfs_init_xattr_rwsem(inode);
Expand Down Expand Up @@ -1832,6 +1833,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
REISERFS_I(inode)->i_attrs =
REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;
sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode);
mutex_init(&(REISERFS_I(inode)->i_mmap));
reiserfs_init_acl_access(inode);
reiserfs_init_acl_default(inode);
reiserfs_init_xattr_rwsem(inode);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/reiserfs_fs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef enum {
i_link_saved_truncate_mask = 0x0020,
i_has_xattr_dir = 0x0040,
i_data_log = 0x0080,
i_ever_mapped = 0x0100
} reiserfs_inode_flags;

struct reiserfs_inode_info {
Expand Down Expand Up @@ -52,6 +53,7 @@ struct reiserfs_inode_info {
** flushed */
unsigned long i_trans_id;
struct reiserfs_journal_list *i_jl;
struct mutex i_mmap;
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
struct posix_acl *i_acl_access;
struct posix_acl *i_acl_default;
Expand Down

0 comments on commit c0325d3

Please sign in to comment.