X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: MVFS results Date: Thu, 16 Jul 2009 16:25:49 +0000 (UTC) Lines: 54 Message-ID: References: <20090715204831 DOT GA27613 AT calimero DOT vinschen DOT de> <20090716090703 DOT GH27613 AT calimero DOT vinschen DOT de> <20090716151121 DOT GO27613 AT calimero DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Corinna Vinschen cygwin.com> writes: > > > For instance, maybe it chokes on the sharing flags. I'd try with > > > FILE_SHARE_VALID_FLAGS instead of just FILE_SHARE_DELETE. Nope, still chokes on FILE_SHARE_VALID_FLAGS with access denied. > Another idea would be that the MVFS driver refuses the open request for > DELETE *because* the R/O flag is set. That's wrong behaviour but it is > as it is. If I'm right, you would have to open the file with > FILE_WRITE_ATTRIBUTES permission only, remove the R/O flag, re-open the > file with DELETE access, close the original handle, and then go ahead > with the default unlink procedure, along these lines (tested on FAT): > Definite improvement. I'm now able to delete read-only files on MVFS when they are not held open by any process. I don't know if this rearrangement has any speed penalties for other filesystems that don't have this problem, or if you might want to make the path taken conditional on the file system type. There are still issues trying to delete open files, where readdir() and stat() still see the file after it has been deleted, but utimes() and open() fail because it has been marked for deletion. Do you need an strace() of the rm and what it attempted with the recycle bin? At any rate, as soon as the last handle is closed, then the readdir() and stat() no longer see the file. Maybe for MVFS it would be better to return EBUSY instead of letting unlink succeed when the handle is still open by another process: $ touch foo $ chmod a-w foo $ exec 5