Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98849
b: refs/heads/master
c: 49641f1
h: refs/heads/master
i:
  98847: dd3a509
v: v3
  • Loading branch information
Dave Chinner authored and Linus Torvalds committed Jul 11, 2008
1 parent f0dc5ff commit c835184
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 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: 61ca9daa2ca3022dc9cb22bd98e69c1b61e412ad
refs/heads/master: 49641f1acfdfd437ed9b0a70b86bf36626c02afe
15 changes: 11 additions & 4 deletions trunk/fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,13 +2427,20 @@ xlog_state_get_iclog_space(xlog_t *log,
if (iclog->ic_size - iclog->ic_offset < 2*sizeof(xlog_op_header_t)) {
xlog_state_switch_iclogs(log, iclog, iclog->ic_size);

/* If I'm the only one writing to this iclog, sync it to disk */
if (atomic_read(&iclog->ic_refcnt) == 1) {
/*
* If I'm the only one writing to this iclog, sync it to disk.
* We need to do an atomic compare and decrement here to avoid
* racing with concurrent atomic_dec_and_lock() calls in
* xlog_state_release_iclog() when there is more than one
* reference to the iclog.
*/
if (!atomic_add_unless(&iclog->ic_refcnt, -1, 1)) {
/* we are the only one */
spin_unlock(&log->l_icloglock);
if ((error = xlog_state_release_iclog(log, iclog)))
error = xlog_state_release_iclog(log, iclog);
if (error)
return error;
} else {
atomic_dec(&iclog->ic_refcnt);
spin_unlock(&log->l_icloglock);
}
goto restart;
Expand Down

0 comments on commit c835184

Please sign in to comment.