Bug 239678 - connectathon op_chmod test fails when run against win2k3 server
Summary: connectathon op_chmod test fails when run against win2k3 server
Status: CLOSED DUPLICATE of bug 465143
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel   
(Show other bugs)
Version: 5.0
Hardware: All Linux
Target Milestone: ---
: ---
Assignee: Jeff Layton
QA Contact: Red Hat Kernel QE team
: 446147 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2007-05-10 14:50 UTC by Jeff Layton
Modified: 2009-02-17 18:06 UTC (History)
3 users (show)

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

Attachments (Terms of Use)

Description Jeff Layton 2007-05-10 14:50:50 UTC
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");

...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 19:05:56 UTC
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 20:25:23 UTC
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 21:20:08 UTC
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 15:09:41 UTC
*** Bug 446147 has been marked as a duplicate of this bug. ***

Comment 6 Jeff Layton 2008-09-16 13:48:00 UTC
Patchset pushed upstream to fix this. Awaiting comment...

Comment 7 Jeff Layton 2009-02-17 18:06:15 UTC
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.