xfs
[Top] [All Lists]

TAKE 983925 - Fix reference counting race on log buffers

To: sgi.bugs.xfs@xxxxxxxxxxxx, xfs@xxxxxxxxxxx
Subject: TAKE 983925 - Fix reference counting race on log buffers
From: lachlan@xxxxxxx (Lachlan McIlroy)
Date: Fri, 15 Aug 2008 13:23:42 +1000 (EST)
Sender: xfs-bounce@xxxxxxxxxxx
Fix reference counting race on log buffers

    When we release the iclog, we do an atomic_dec_and_lock to determine if
    we are the last reference and need to trigger update of log headers and
    writeout.  However, in xlog_state_get_iclog_space() we also need to
    check if we have the last reference count there.  If we do, we release
    the log buffer, otherwise we decrement the reference count.
    
    But the compare and decrement in xlog_state_get_iclog_space() is not
    atomic, so both places can see a reference count of 2 and neither will
    release the iclog.  That leads to a filesystem hang.
    
    Close the race by replacing the atomic_read() and atomic_dec() pair with
    atomic_add_unless() to ensure that they are executed atomically.
    
    Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>

Date:  Fri Aug 15 13:22:52 AEST 2008
Workarea:  redback.melbourne.sgi.com:/home/lachlan/isms/2.6.x-clean
Inspected by:  
david@xxxxxxxxxxxxx
tes
lachlan
Author:  lachlan

The following file(s) were checked into:
  longdrop.melbourne.sgi.com:/isms/linux/2.6.x-xfs-melb


Modid:  xfs-linux-melb:xfs-kern:31904a
fs/xfs/xfs_log.c - 1.365 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_log.c.diff?r1=text&tr1=1.365&r2=text&tr2=1.364&f=h
        - Fix reference counting race on log buffers




<Prev in Thread] Current Thread [Next in Thread>
  • TAKE 983925 - Fix reference counting race on log buffers, Lachlan McIlroy <=