Bug 239678 - connectathon op_chmod test fails when run against win2k3 server
connectathon op_chmod test fails when run against win2k3 server
Status: CLOSED DUPLICATE of bug 465143
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.0
All Linux
low Severity low
: ---
: ---
Assigned To: Jeff Layton
Red Hat Kernel QE team
:
: 446147 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-10 10:50 EDT by Jeff Layton
Modified: 2009-02-17 13:06 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-17 13:06:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Layton 2007-05-10 10:50:50 EDT
This test seems to reliably work when run against samba, but fails when run
against windows2k3.

In one shell run a perl script like this on a CIFS filesystem mounted on win2k3:

open(FILE, ">testfile") or die("Can't open testfile\n");
print("Hit return to continue\n");
<STDIN>;

...in another shell, chmod 0 testfile and then attempt to delete it. It will fail:

unlink("testfile")                      = -1 EACCES (Permission denied)

If you don't chmod the file, or if the file isn't open then it works.
Comment 1 Jeff Layton 2007-05-10 15:05:56 EDT
If the file is open on the client and no write bits are set then trying to
unlink the file throws back an EPERM. My guess is that this is setting the
ATTR_READONLY dos attribute on the server and that's what's causing it. On samba
w/o unix extensions enabled, it allows the file to be removed.
Comment 3 Jeff Layton 2008-05-20 16:25:23 EDT
Ok, having another look at this. We attempt to delete the file, and if it fails
then we open the file and set the delete on close bit, and try to rename it.

I don't think that you can legally set the delete_on_close bit in an open call
unless you're actually creating the file at the same time. JRA explained this to
me at connectathon. Samba apparently ignores this bit unless you're creating the
file. I think if we do a SET_FILE_INFO call with this bit set then that may
work. This is something that needs fixing anyway...
Comment 4 Jeff Layton 2008-05-20 17:20:08 EDT
I hacked up a quick patch to not set the delete on close bit in the CreateAndX
call, and instead to set it with a SetFileInfo call. Everything works as it should.

I don't want to just add this code in, however. The cifs_unlink code needs some
cleanup. There's a lot of cut and paste work in there and it's heavily indented
already. Once my I get my setattr cleanup upstream, I'll plan to take a crack at
this and see if we can fix it.
Comment 5 Jeff Layton 2008-05-23 11:09:41 EDT
*** Bug 446147 has been marked as a duplicate of this bug. ***
Comment 6 Jeff Layton 2008-09-16 09:48:00 EDT
Patchset pushed upstream to fix this. Awaiting comment...
Comment 7 Jeff Layton 2009-02-17 13:06:15 EST
Patchset went upstream. Closing as duplicate of cifs update BZ.

*** This bug has been marked as a duplicate of bug 465143 ***

Note You need to log in before you can comment on or make changes to this bug.