delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/19/12:43:59

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.5 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,TW_FC
X-Spam-Check-By: sourceware.org
Message-ID: <4E9EFE31.20809@lauterbach.com>
Date: Wed, 19 Oct 2011 18:43:29 +0200
From: Franz Sirl <Franz DOT Sirl-kernel AT lauterbach DOT com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: rm -rf cannot delete the upmost directory level anymore on a Novell share
References: <4E9EE8CC DOT 5090806 AT lauterbach DOT com> <20111019154540 DOT GE22809 AT calimero DOT vinschen DOT de>
In-Reply-To: <20111019154540.GE22809@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Am 2011-10-19 17:45, schrieb Corinna Vinschen:
> On Oct 19 17:12, Franz Sirl wrote:
>> Hi,
>>
>> sometime between coreutils-7.0 and coreutils-8.4 (sorry, I don't
>> have any other in between versions anymore) this simple command
>> started to fail:
>>
>> # mkdir -p lev1/lev2/lev3
>> # rm -rfv lev1
>> removed directory: `lev1/lev2/lev3'
>> removed directory: `lev1/lev2'
>> rm: cannot remove `lev1': Device or resource busy
>>
>> Tested with coreutils-8.10 and cygwin1.dll from the 20111017
>> snapshot, as the cygwin1.dll didn't make any difference for the
>> problem.
>>
>> If I just use rm.exe from coreutils-7.0 everything starts to work as
>> expected again:
>>
>> # mkdir -p lev1/lev2/lev3
>> # rm -rfv lev1
>> removed directory: `lev1/lev2/lev3'
>> removed directory: `lev1/lev2'
>> removed directory: `lev1'
>
> The problem is, it works fine on local and remote NTFS, as well as on
> Samba.  Since the number of open handles doesn't depend on the underlying
> filesystem, why should it fail for NWFS?

True. But on the other hand NWFS and NcFsd exercise a lot of pathes in 
the Cygwin sourcecode that aren't usually used. Even between NWFS on XP 
and NcFsd on Win7 there are differences, because fs.is_nwfs() doesn't 
trigger on Win7 with the Novell Client (the filesystem name is different).

If it turns out to be a problem in the Novell Client, I can work with 
Novell to fix it (for the Vista/Win7 client), but right now I'm not sure 
who's problem it is.

>> Looking at the strace output of both rm-7.0 and rm-8.10 it seems
>> that rm-8.10 thinks that lev1 is a file, because it uses unlink_nt()
>> first.
>
> unlink_nt is used by unlink as well as by rmdir since the system calls
> to delete a file are the same as the calls to delete a directory.

I see.

>>    216  174576 [main] rm-8.10 336 unlink_nt: Opening file for delete
>> failed, status = 0xC0000043
>>    240  174816 [main] rm-8.10 336 seterrno_from_nt_status: /netrel/src/cygwin-snapshot-20111017-1/winsup/cygwin/fhandler_disk_file.cc:1735
>> status 0xC0000043 ->  windows error 32
>
> That's a sharing violation.  Where's the difference to the strace
> output with the exact same Cygwin DLL and rm from coreutils 7?

Hmm, I just see that on Win7 the errorcode for unlink_nt is different, 
for completeness:

...
  2046  158907 [main] rm-8.10 2940 unlink_nt: Setting delete disposition 
failed, status = 0xC0000121
   594  159501 [main] rm-8.10 2940 seterrno_from_nt_status: 
/netrel/src/cygwin-snapshot-20111017-1/winsup/cygwin/fhandler_disk_file.cc:1735 
status 0xC0000121 -> windows error 5
   193  159694 [main] rm-8.10 2940 geterrno_from_win_error: windows 
error 5 == errno 13
   283  159977 [main] rm-8.10 2940 rmdir: -1 = rmdir (/test_rm_rf/lev1)
...

The strace from rm-7.0 on XP looks like this:

...
  3998  159342 [main] rm-7.0 360 rmdir: 0 = rmdir 
(/test_rm_rf/lev1/lev2/lev3)
   435  159777 [main] rm-7.0 360 fhandler_base::set_close_on_exec: set 
close_on_exec for /test_rm_rf/lev1/lev2 to 1
   225  160002 [main] rm-7.0 360 fhandler_disk_file::opendir: 0x20044A20 
= opendir (/test_rm_rf/lev1/lev2)
   272  160274 [main] rm-7.0 360 fhandler_base::fstat_helper: 0 = fstat 
(\??\J:\FRA\test_rm_rf\lev1\lev2, 0x22C7D0) st_size=0, st_mode=0x41ED, 
st_ino=-5551660102295404609st_atim=0.0 st_ctim=4E9EE2B4.0 
st_mtim=4E9EE2B4.0 st_birthtim=4E9EE2B4.0
   258  160532 [main] rm-7.0 360 fstat64: 0 = fstat (4, 0x22C7D0)
   788  161320 [main] rm-7.0 360 fhandler_disk_file::readdir: 0 = 
readdir (0x20044A20, 0x22C704) (L"." > ".") (attr 0x10 > type 4)
   146  161466 [main] rm-7.0 360 fhandler_disk_file::readdir: 0 = 
readdir (0x20044A20, 0x22C704) (L".." > "..") (attr 0x10 > type 4)
   265  161731 [main] rm-7.0 360 normalize_posix_path: src 
/test_rm_rf/lev1/lev2/..
   132  161863 [main] rm-7.0 360 normalize_posix_path: /test_rm_rf/lev1/ 
= normalize_posix_path (/test_rm_rf/lev1/lev2/..)
   266  162129 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
conv_to_win32_path (/test_rm_rf/lev1)
   134  162263 [main] rm-7.0 360 set_flags: flags: binary (0x2)
   266  162529 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
src_path /test_rm_rf/lev1, dst J:\FRA\test_rm_rf\lev1, flags 0x3000A, rc 0
   198  162727 [main] rm-7.0 360 symlink_info::check: 0x0 = NtCreateFile 
(\??\J:\FRA\test_rm_rf\lev1)
   214  162941 [main] rm-7.0 360 symlink_info::check: not a symlink
   254  163195 [main] rm-7.0 360 symlink_info::check: 0 = symlink.check 
(J:\FRA\test_rm_rf\lev1, 0x22B350) (0x43000A)
   266  163461 [main] rm-7.0 360 path_conv::check: 
this->path(J:\FRA\test_rm_rf\lev1), has_acls(0)
   290  163751 [main] rm-7.0 360 geterrno_from_win_error: windows error 
18 == errno 89
   243  163994 [main] rm-7.0 360 fhandler_disk_file::readdir: 89 = 
readdir (0x20044A20, 0x22C704) (L"(null)" > "***") (attr 0x0 > type 0)
   269  164263 [main] rm-7.0 360 fcntl64: 1 = fcntl (4, 1, 0x8)
   295  164558 [main] rm-7.0 360 open: open (/test_rm_rf/lev1/lev2/.., 0x0)
   235  164793 [main] rm-7.0 360 normalize_posix_path: src 
/test_rm_rf/lev1/lev2/..
   265  165058 [main] rm-7.0 360 normalize_posix_path: /test_rm_rf/lev1/ 
= normalize_posix_path (/test_rm_rf/lev1/lev2/..)
   266  165324 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
conv_to_win32_path (/test_rm_rf/lev1)
   134  165458 [main] rm-7.0 360 set_flags: flags: binary (0x2)
   265  165723 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
src_path /test_rm_rf/lev1, dst J:\FRA\test_rm_rf\lev1, flags 0x3000A, rc 0
   198  165921 [main] rm-7.0 360 symlink_info::check: 0x0 = NtCreateFile 
(\??\J:\FRA\test_rm_rf\lev1)
   214  166135 [main] rm-7.0 360 symlink_info::check: not a symlink
   270  166405 [main] rm-7.0 360 symlink_info::check: 0 = symlink.check 
(J:\FRA\test_rm_rf\lev1, 0x22B320) (0x3000A)
   252  166657 [main] rm-7.0 360 path_conv::check: 
this->path(J:\FRA\test_rm_rf\lev1), has_acls(0)
   268  166925 [main] rm-7.0 360 build_fh_pc: fh 0x612564DC, dev 0xC3
   133  167058 [main] rm-7.0 360 fhandler_base::open: 
(\??\J:\FRA\test_rm_rf\lev1, 0x108000)
   325  167383 [main] rm-7.0 360 fhandler_base::set_flags: flags 
0x108000, supplied_bin 0x10000
   205  167588 [main] rm-7.0 360 fhandler_base::set_flags: filemode set 
to binary
   265  167853 [main] rm-7.0 360 fhandler_base::open: 0 = NtCreateFile 
(0x704, 80100000, \??\J:\FRA\test_rm_rf\lev1, io, NULL, 0, 7, 1, 4020, 
NULL, 0)
   266  168119 [main] rm-7.0 360 fhandler_base::open: 1 = 
fhandler_base::open (\??\J:\FRA\test_rm_rf\lev1, 0x108000)
   139  168258 [main] rm-7.0 360 fhandler_base::open_fs: 1 = 
fhandler_disk_file::open (\??\J:\FRA\test_rm_rf\lev1, 0x8000)
   263  168521 [main] rm-7.0 360 open: 3 = open 
(/test_rm_rf/lev1/lev2/.., 0x8000)
   188  168709 [main] rm-7.0 360 fhandler_disk_file::closedir: 0 = 
closedir (0x20044A20, /test_rm_rf/lev1/lev2)
   306  169015 [main] rm-7.0 360 closedir: 0 = closedir (0x0)
   183  169198 [main] rm-7.0 360 fhandler_base::fstat_helper: 0 = fstat 
(\??\J:\FRA\test_rm_rf\lev1, 0x22C918) st_size=0, st_mode=0x41ED, 
st_ino=-5408388998266319118st_atim=0.0 st_ctim=4E9EE2B4.0 
st_mtim=4E9EE2B4.0 st_birthtim=4E9EE0C4.0
   254  169452 [main] rm-7.0 360 fstat64: 0 = fstat (3, 0x22C918)
   268  169720 [main] rm-7.0 360 normalize_posix_path: src 
/test_rm_rf/lev1/lev2
   130  169850 [main] rm-7.0 360 normalize_posix_path: 
/test_rm_rf/lev1/lev2 = normalize_posix_path (/test_rm_rf/lev1/lev2)
   266  170116 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
conv_to_win32_path (/test_rm_rf/lev1/lev2)
   134  170250 [main] rm-7.0 360 set_flags: flags: binary (0x2)
   265  170515 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
src_path /test_rm_rf/lev1/lev2, dst J:\FRA\test_rm_rf\lev1\lev2, flags 
0x3000A, rc 0
   202  170717 [main] rm-7.0 360 symlink_info::check: 0x0 = NtCreateFile 
(\??\J:\FRA\test_rm_rf\lev1\lev2)
   210  170927 [main] rm-7.0 360 symlink_info::check: not a symlink
   271  171198 [main] rm-7.0 360 symlink_info::check: 0 = symlink.check 
(J:\FRA\test_rm_rf\lev1\lev2, 0x22B320) (0x3000A)
   251  171449 [main] rm-7.0 360 path_conv::check: 
this->path(J:\FRA\test_rm_rf\lev1\lev2), has_acls(0)
   267  171716 [main] rm-7.0 360 build_fh_pc: fh 0x61256944, dev 0xC3
  3067  174783 [main] rm-7.0 360 rmdir: 0 = rmdir (/test_rm_rf/lev1/lev2)
   428  175211 [main] rm-7.0 360 fhandler_base::set_close_on_exec: set 
close_on_exec for /test_rm_rf/lev1 to 1
   233  175444 [main] rm-7.0 360 fhandler_disk_file::opendir: 0x20044A20 
= opendir (/test_rm_rf/lev1)
   271  175715 [main] rm-7.0 360 fhandler_base::fstat_helper: 0 = fstat 
(\??\J:\FRA\test_rm_rf\lev1, 0x22C7D0) st_size=0, st_mode=0x41ED, 
st_ino=-5408388998266319118st_atim=0.0 st_ctim=4E9EE2B4.0 
st_mtim=4E9EE2B4.0 st_birthtim=4E9EE0C4.0
   260  175975 [main] rm-7.0 360 fstat64: 0 = fstat (3, 0x22C7D0)
   921  176896 [main] rm-7.0 360 fhandler_disk_file::readdir: 0 = 
readdir (0x20044A20, 0x22C704) (L"." > ".") (attr 0x10 > type 4)
   145  177041 [main] rm-7.0 360 fhandler_disk_file::readdir: 0 = 
readdir (0x20044A20, 0x22C704) (L".." > "..") (attr 0x10 > type 4)
   264  177305 [main] rm-7.0 360 normalize_posix_path: src 
/test_rm_rf/lev1/..
   133  177438 [main] rm-7.0 360 normalize_posix_path: /test_rm_rf/ = 
normalize_posix_path (/test_rm_rf/lev1/..)
   266  177704 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
conv_to_win32_path (/test_rm_rf)
   135  177839 [main] rm-7.0 360 set_flags: flags: binary (0x2)
   264  178103 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
src_path /test_rm_rf, dst J:\FRA\test_rm_rf, flags 0x3000A, rc 0
   185  178288 [main] rm-7.0 360 symlink_info::check: 0x0 = NtCreateFile 
(\??\J:\FRA\test_rm_rf)
   226  178514 [main] rm-7.0 360 symlink_info::check: not a symlink
   256  178770 [main] rm-7.0 360 symlink_info::check: 0 = symlink.check 
(J:\FRA\test_rm_rf, 0x22B350) (0x43000A)
   266  179036 [main] rm-7.0 360 path_conv::check: 
this->path(J:\FRA\test_rm_rf), has_acls(0)
   288  179324 [main] rm-7.0 360 geterrno_from_win_error: windows error 
18 == errno 89
   245  179569 [main] rm-7.0 360 fhandler_disk_file::readdir: 89 = 
readdir (0x20044A20, 0x22C704) (L"(null)" > "***") (attr 0x0 > type 0)
   269  179838 [main] rm-7.0 360 fcntl64: 1 = fcntl (3, 1, 0x8)
   344  180182 [main] rm-7.0 360 fhandler_disk_file::closedir: 0 = 
closedir (0x20044A20, /test_rm_rf/lev1)
   282  180464 [main] rm-7.0 360 closedir: 0 = closedir (0x0)
   178  180642 [main] rm-7.0 360 normalize_posix_path: src /test_rm_rf/lev1
   256  180898 [main] rm-7.0 360 normalize_posix_path: /test_rm_rf/lev1 
= normalize_posix_path (/test_rm_rf/lev1)
   135  181033 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
conv_to_win32_path (/test_rm_rf/lev1)
   266  181299 [main] rm-7.0 360 set_flags: flags: binary (0x2)
   133  181432 [main] rm-7.0 360 mount_info::conv_to_win32_path: 
src_path /test_rm_rf/lev1, dst J:\FRA\test_rm_rf\lev1, flags 0x3000A, rc 0
   329  181761 [main] rm-7.0 360 symlink_info::check: 0x0 = NtCreateFile 
(\??\J:\FRA\test_rm_rf\lev1)
   214  181975 [main] rm-7.0 360 symlink_info::check: not a symlink
   271  182246 [main] rm-7.0 360 symlink_info::check: 0 = symlink.check 
(J:\FRA\test_rm_rf\lev1, 0x22B320) (0x3000A)
   252  182498 [main] rm-7.0 360 path_conv::check: 
this->path(J:\FRA\test_rm_rf\lev1), has_acls(0)
   136  182634 [main] rm-7.0 360 build_fh_pc: fh 0x612564DC, dev 0xC3
  2664  185298 [main] rm-7.0 360 rmdir: 0 = rmdir (/test_rm_rf/lev1)
...

So with rm-7.0 it doesn't try to use unlink_nt() and also rm-8.10 
doesn't try to use unlink_nt() on a samba-3.4.3 share. That's why it 
looked a bit suspicious to me.

Franz

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019