bugrdiff-backup - Bugs: bug #15839, fsync fails on a read-only file

 
 

bug #15839: fsync fails on a read-only file

Submitter:  None
Submitted:  Tue 21 Feb 2006 02:30:57 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 06 Jan 2008 02:13:52 AM UTC, comment #4: 

Dean --

I've looked into this and it actually makes sense. The file was opened read/write at some point in the past, and then closed. Now, we want to fsync() it, so we have to reopen it to get a file handle. We don't need R/W, so we ask for RO, but it doesn't work on some platforms.

I've changed:

if (e.errno != errno.EPERM and e.errno != errno.EACCES) \
or self.isdir(): raise

to

if (e.errno not in (errno.EPERM, errno.EACCES, errno.EBADF)) \
or self.isdir(): raise

in CVS.

Andrew

Andrew Ferguson <owsla>
Group administrator
Sat 01 Sep 2007 05:45:18 PM UTC, comment #3: 

why would we be calling fsync on a read-only file in the first place?

dean gaudet <dgaudet>
Group administrator
Tue 28 Aug 2007 07:08:32 PM UTC, comment #2: 

In cvs, I see:
if (e.errno != errno.EPERM and e.errno != errno.EACCES) \
or self.isdir(): raise

please add ' and e.errno != errno.EBADF'

Thanks!

Peter O'Gorman <pogma>
Tue 28 Aug 2007 06:42:59 PM UTC, comment #1: 

fsync of a read only file is not allowed on AIX or IRIX systems, calling fsync on a file opened readonly gets EBADF. From the AIX-5.3 fsync man page:
"EBADF
The FileDescriptor parameter is not a valid file descriptor open for writing."

Changinh to O_RDWR seems like the appropriate solution.

Peter O'Gorman <pogma>
Tue 21 Feb 2006 02:30:57 PM UTC, original submission:  

I installed rdiff-backup-1.0.4 under AIX 5.3. When running a simple local test backup, I got the following message :

[fthomas@tonga build]$ rdiff-backup SPECS /tmp/backup-fthomas/
Traceback (most recent call last):
  File "/usr/bin/rdiff-backup", line 23, in ?
    rdiff_backup.Main.Main(sys.argv[1:])
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/Main.py", line 285, in Main
    take_action(rps)
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/Main.py", line 255, in take_action
    elif action == "backup": Backup(rps[0], rps[1])
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/Main.py", line 309, in Backup
    rpout.conn.Main.backup_touch_curmirror_local(rpin, rpout)
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/Main.py", line 467, in backup_touch_curmirror_local
    mirrorrp.fsync_with_dir()
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 1080, in fsync_with_dir
    self.fsync(fp)
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 1068, in fsync
    if not fp: self.conn.rpath.RPath.fsync_local(self)
  File "/opt/freeware/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 1075, in fsync_local
    os.fsync(fd)
OSError: [Errno 9] Bad file number
Exception exceptions.TypeError: "'NoneType' object is not callable" in <bound method GzipFile.__del__ of <gzip open file '/tmp/backup-fthomas/rdiff-backup-data/error_log.2006-02-21T15:27:37+01:00.data.gz', mode 'wb' at 0x202940e8 0x20293698>> ignored

I commented out the os.fsync(fd) line in rpath.py and the problem went away. I believe this is related to the fact that the file is open in read-only and that it's probably forbidden to fsync a file that's open in read-only.

excerpt from rpath.py :

        def fsync_local(self):
                """fsync current file, run locally"""
                assert self.conn is Globals.local_connection
                fd = os.open(self.path, os.O_RDONLY)
                #os.fsync(fd)
                os.close(fd)


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by owsla (Posted a comment)
  • -email is unavailable- added by dgaudet (Posted a comment)
  • -email is unavailable- added by pogma (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-01-06 owsla StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code