bugrdiff-backup - Bugs: bug #19895, On cifs volume,...


bug #19895: On cifs volume, set_escape_dos_devices raises "Permission denied" exception when lstat called on "aux"

Submitted by:  Jonathan Hankins <jonathanhankins>
Submitted on:  Fri 18 May 2007 03:09:14 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 19 May 2007 06:43:08 PM UTC, comment #2: 

applied to cvs, thanks

dean gaudet <dgaudet>
Project Administrator
Sat 19 May 2007 03:26:52 AM UTC, comment #1: 

Here's my patch to catch the OSError that is raised when you try to lstat the "aux" (or any other) special file on a CIFS-mounted Windows share.

I originally fixed one location where it tries to lstat "aux" then found two more :-)  So, I am including them in the patch as well.

In fact, it looks like the OSError is raised somewhere in subdir.append("aux") before the lstat is called, but I didn't look too deeply at this.  I just wrapped anything that could raise an exception in a try.

I wasn't sure why the original code did an "if device_rp.lstat()" and then, depending on that call, did an "assert device_rp.lstat()" or "assert not device_rp.lstat()", so I changed that in my patch.  I don't "do" python, so please correct it if I was wrong.  Now, if lstat returns a true value, indicating that "aux" exists (I don't think it can do this on a CIFS-mounted Windows share), or if an OSError is raised (this seems to always happen on a CIFS-mounted Windows share), it will escape dos devices, otherwise it will not.

See also my bug report #19896.  After applying this patch and the one from #19896, and the setting LookupCacheEnabled to 0 via proc fs (see #19802), I am able to backup to and restore to a CIFS-mounted Windows share, on linux kernel 2.6.20.

(file #12800)

Jonathan Hankins <jonathanhankins>
Fri 18 May 2007 03:09:14 AM UTC, original submission:  

In fs_abilities.py, set_escape_dos_devices tries to lstat "aux" and raises this error:

Exception '[Errno 13] Permission denied: '/mnt/cifs/winsnap/snapshot/Latin I/rdiff-backup.tmp.23/aux'' raised of class 'exceptions.OSError':

With kernel-2.6.20, on a cifs-mounted Windows share, you get permission denied when you lstat any of the DOS "special" files, such as "aux" and "nul".  Simply doing a "ls /path/to/cifs/mount/aux" should show the error.

I found some hints googling for "cifs aux nul" that indicate that it is an error to attempt to access these files over CIFS.

On a NetWare CIFS volume, there is no "aux" so the check works correctly.  I assume the same is true for a samba share.

Just for kicks, a cifs kernel debug trace shows something like:

May 17 16:35:59 bkupserv kernel:  fs/cifs/inode.c: Getting info on \aux
May 17 16:35:59 bkupserv kernel:  fs/cifs/transport.c: For smb_command 50
May 17 16:35:59 bkupserv kernel:  fs/cifs/transport.c: Sending smb of length 82
May 17 16:35:59 bkupserv kernel:  fs/cifs/connect.c: rfc1002 length 0x27)
May 17 16:35:59 bkupserv kernel:  fs/cifs/connect.c: invalid transact2 word count
May 17 16:35:59 bkupserv kernel: Status code returned 0xc0000022 NT_STATUS_ACCESS_DENIED
May 17 16:35:59 bkupserv kernel:  fs/cifs/netmisc.c:  !!Mapping smb error code 5 to POSIX err -13 !!
May 17 16:35:59 bkupserv kernel:  fs/cifs/cifssmb.c: Send error in QPathInfo = -13
May 17 16:35:59 bkupserv kernel:  CIFS VFS: Error 0xfffffff3 on cifs_get_inode_info in lookup of \aux
May 17 16:35:59 bkupserv kernel:  fs/cifs/dir.c: CIFS VFS: leaving cifs_lookup (xid = 3966) rc = -13

Jonathan Hankins <jonathanhankins>


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

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by dgaudet (Posted a comment)
  • -email is unavailable- added by jonathanhankins (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-05-19 dgaudet StatusNone => Fixed
        Open/ClosedOpen => Closed
    2007-05-19 jonathanhankins Attached File- => Added fs_abilities.py.set_escape_dos_devices.diff, #12800

    Back to the top

    Powered by Savane 3.5