Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 372728
b: refs/heads/master
c: 5ae98f1
h: refs/heads/master
v: v3
  • Loading branch information
Jan Kara authored and Al Viro committed May 4, 2013
1 parent 0749fe1 commit 06b5347
Show file tree
Hide file tree
Showing 3 changed files with 14 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: 9dcc26cf67fb7db7613290e62eeed6c4276c75ce
refs/heads/master: 5ae98f1589e076e4b314fc54ae2beac58842ddc2
7 changes: 7 additions & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,13 @@ static inline void file_start_write(struct file *file)
__sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
}

static inline bool file_start_write_trylock(struct file *file)
{
if (!S_ISREG(file_inode(file)->i_mode))
return true;
return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false);
}

static inline void file_end_write(struct file *file)
{
if (!S_ISREG(file_inode(file)->i_mode))
Expand Down
7 changes: 6 additions & 1 deletion trunk/kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,16 @@ static void do_acct_process(struct bsd_acct_struct *acct,
ac.ac_rw = encode_comp_t(ac.ac_io / 1024);
ac.ac_swaps = encode_comp_t(0);

/*
* Get freeze protection. If the fs is frozen, just skip the write
* as we could deadlock the system otherwise.
*/
if (!file_start_write_trylock(file))
goto out;
/*
* Kernel segment override to datasegment and write it
* to the accounting file.
*/
file_start_write(file);
fs = get_fs();
set_fs(KERNEL_DS);
/*
Expand Down

0 comments on commit 06b5347

Please sign in to comment.