All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel-IBi9RG/b67k@public.gmane.org>
To: Pavel Shilovsky
	<piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Ronnie Sahlberg
	<lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] cifs: fix return code when failing to rename a file onto a directory
Date: Fri, 17 Nov 2017 16:10:40 +0100	[thread overview]
Message-ID: <mpsshddos9b.fsf@aaptelpc.suse.de> (raw)
In-Reply-To: <CAKywueStf29fgZ-52ONqL+WLSYotaVwMpsqnu2gQdppuw5xtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> What if the target is directory but the permissions are read-only?

I get the same resulsts on a local filesystem (xfs) and on a mounted
smb2 windows2016 share (both with and without the patch applied):

overwrite dir b with file a (with access to b)
=======================
rename("test/a", "test/b")              = -1 EISDIR (Is a directory)

overwrite dir b with file a (without access to b)
=======================
rename("test/a", "test/b")              = -1 EISDIR (Is a directory)

overwrite file b with file a (with access to b)
=======================
rename("test/a", "test/b")              = 0

overwrite file b with file a (without access to b)
=======================
rename("test/a", "test/b")              = 0

So.. I'm not sure what the xfstest test is doing.

The only difference between the local and remote fs is that for cifs you
can't delete test if you can't access test/b. (I am deleting "test"
between my tests).

That is on cifs:

  mkdir -p test/b
  chmod a-rw test/b
  rm -rf test

Will fail, but works on xfs. You you strace rm you will see:

  unlinkat(4, "b", AT_REMOVEDIR) = -1 EACCES (Permission denied)

I think this is due to the fundamental difference in how file removal
permission works in Windows vs POSIX. In POSIX you need +w on the parent
dir ("test") to be able to delete a file. On Windows there is a special
delete permission on the object itself. Not sure if this is "fixable".

Cheers,

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

  parent reply	other threads:[~2017-11-17 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 23:52 [PATCH] cifs: fix return code when failing to rename a file onto a directory Ronnie Sahlberg
     [not found] ` <20171109235249.8013-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-16 23:31   ` Pavel Shilovsky
     [not found]     ` <CAKywueStf29fgZ-52ONqL+WLSYotaVwMpsqnu2gQdppuw5xtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 23:38       ` Steve French
2017-11-17 15:10       ` Aurélien Aptel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-11-20  5:25 Ronnie Sahlberg
     [not found] ` <20171120052549.17909-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-20 21:09   ` ronnie sahlberg
     [not found]     ` <CAN05THT53nWN7w161L6CVc0ZjwFbBC+1zcO++z4DdXzQoh=CqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-20 21:17       ` Steve French
2017-11-09  5:11 Ronnie Sahlberg
     [not found] ` <20171109051157.30814-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-09 10:54   ` Aurélien Aptel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mpsshddos9b.fsf@aaptelpc.suse.de \
    --to=aaptel-ibi9rg/b67k@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.