perm error on mount point

View: New views
7 Messages — Rating Filter:   Alert me  

perm error on mount point

by pouchat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've a problem with mount.cifs using kernel > 2.6.24 (so with cifs > 1.52). With some shares, permission on the mount point
are not applied.

Test on debian base distro (kernel 2.6.26-2), when i mount using the option dir_mode=0755, the mask is not apply to
the mount point but just on the sub-dir. This problem occurs on some windows shares (that are automatically
made by a external program on my windows 2003 server).

With the share "MYSHARE" : error (same error if i don't use dir_mode option)
$> mount -t cifs //192.168.224.1/MYSHARE$ TEST -o username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
$> ll .
dr-xr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:14 TEST

With other share "OTHERSHARE" : ok (event if i don't use dir_mode option, permission are corrects)
$> mount -t cifs //192.168.224.1/OTHERSHARE$ TEST -o username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
$> ll .
drwxr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:14 TEST


If i booted from kernel 2.6.24 with exactly same command, everything works as expect for all shares:
$> mount -t cifs //192.168.224.1/MYSHARE$ TEST -o username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
$> ll .
drwxr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:19 TEST

I use mount-2.13.1.1-1, smbfs-3.2.5-4lenny2 and samba-common-3.2.5-4lenny2

So why with kernel 2.6.26 dir_mode is not applied to the mount point on some share whereas with 2.6.24 it always works !

thanks,


_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Re: perm error on mount point

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 17 Jun 2009 10:35:53 +0200
<pouchat@...> wrote:

>
>
> Hi,
> I've a problem with mount.cifs using kernel > 2.6.24 (so with cifs >
> 1.52). With some shares, permission on the mount point
> are not applied.
>
> Test on debian base distro (kernel 2.6.26-2), when i mount using the
> option dir_mode=0755, the mask is not apply to
> the mount point but just on the sub-dir. This problem occurs on some
> windows shares (that are automatically
> made by a external program on my windows 2003 server).
>
> With the share "MYSHARE" : error (same error if i don't use dir_mode
> option)
> $> mount -t cifs //192.168.224.1/MYSHARE$ TEST -o
> username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
> $> ll .
> dr-xr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:14 TEST
>
> With other share "OTHERSHARE" : ok (event if i don't use dir_mode option,
> permission are corrects)
> $> mount -t cifs //192.168.224.1/OTHERSHARE$ TEST -o
> username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
> $> ll .
> drwxr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:14 TEST
>
> If i booted from kernel 2.6.24
> with exactly same command, everything works
> as expect for all shares:
> $> mount -t cifs //192.168.224.1/MYSHARE$ TEST -o
> username=admin,uid=10066,gid=10000,dir_mode=0755 --verbose
> $> ll .
> drwxr-xr-x 1 admin utilisa._du_domaine 0 jun 11 17:19 TEST
>
> I use mount-2.13.1.1-1, smbfs-3.2.5-4lenny2 and samba-common-3.2.5-4lenny2
>
> So why with kernel 2.6.26 dir_mode is not applied to the mount point on
> some share whereas with 2.6.24 it always works !
>
> thanks,

It's probably because the server has the ATTR_READONLY bit set on the
directory that corresponds to MYSHARE$. Later versions of CIFS detect
this and clear all of the write bits in the mode when it's present.

--
Jeff Layton <jlayton@...>
_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Parent Message unknown Re: perm error on mount point

by pouchat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for explanations !

So i've understood, cifs in kernel 2.6.24 will bypass ATTR_READONLY bit set
on the windows server and forced the dir_mode option to the mount point.
In the kernel 2.6.26, it don't do it.

There is a way or a patch to retrieved the same behaviour in the 2.6.26 ?
_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Re: perm error on mount point

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 18 Jun 2009 08:45:16 +0200
<pouchat@...> wrote:

> Thanks for explanations !
>
> So i've understood, cifs in kernel 2.6.24 will bypass ATTR_READONLY bit set
> on the windows server and forced the dir_mode option to the mount point.
> In the kernel 2.6.26, it don't do it.
>

Well, not exactly. The 2.6.24 code just didn't pay attention to that
bit.

> There is a way or a patch to retrieved the same behaviour in the 2.6.26 ?

No. Is there some reason you feel the need to pretend that the
directory is writable when it isn't?

--
Jeff Layton <jlayton@...>
_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Parent Message unknown Re: perm error on mount point

by pouchat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> On Thu, 18 Jun 2009 11:31:30 -0400, Jeff Layton <jlayton@...>
wrote:
>
> No. Is there some reason you feel the need to pretend that the
> directory is writable when it isn't?

Yes, because it is writable : my share are ALL WRITABLE for user (username
and uid
option that i pass during the mount). So 2.6.24 have FOR ME the correct
behaviour (perms). During my search i've also found that force the
dir_mode to 0000 solve partially my problem : writable, but only for
root...

Finally, the problem (often) come from microsoft : they use the read only
attribut instead of the system attribut. As they discuss in this page
http://support.microsoft.com/kb/256614 on readonly bit : "some programs can
display errors while trying to write file in this - fake readonly - dir".
Maybe the case with cifs in kernel 2.6.26 or later. I've tried the regedit
they proprosed and after reload cifs all my shares were mounted with
corrects
perms : rwxr-xr-x instead of r-x-r-xr-x.

So for the moment it works, hope for a long time ;) and thanks for
spending time to answer and to help !
_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Re: perm error on mount point

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 19 Jun 2009 08:46:11 +0200
<pouchat@...> wrote:

> > On Thu, 18 Jun 2009 11:31:30 -0400, Jeff Layton <jlayton@...>
> wrote:
> >
> > No. Is there some reason you feel the need to pretend that the
> > directory is writable when it isn't?
>
> Yes, because it is writable : my share are ALL WRITABLE for user (username
> and uid
> option that i pass during the mount). So 2.6.24 have FOR ME the correct
> behaviour (perms). During my search i've also found that force the
> dir_mode to 0000 solve partially my problem : writable, but only for
> root...
>
> Finally, the problem (often) come from microsoft : they use the read only
> attribut instead of the system attribut. As they discuss in this page
> http://support.microsoft.com/kb/256614 on readonly bit : "some programs can
> display errors while trying to write file in this - fake readonly - dir".
> Maybe the case with cifs in kernel 2.6.26 or later. I've tried the regedit
> they proprosed and after reload cifs all my shares were mounted with
> corrects
> perms : rwxr-xr-x instead of r-x-r-xr-x.
>
> So for the moment it works, hope for a long time ;) and thanks for
> spending time to answer and to help !

(cc'ing Steve)

Thanks for the pointer. This article actually has a little more info:

http://support.microsoft.com/kb/326549/

Here's a key phrase:

"Unlike the Read-only attribute for a file, the Read-only attribute for
a folder is typically ignored by Windows, Windows components and
accessories, and other programs."

...perhaps we need to change this behavior so that the write bit isn't
cleared on directories with ATTR_READONLY set? What's samba's behavior
in this regard?

Steve, thoughts?

--
Jeff Layton <jlayton@...>
_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

Re: perm error on mount point

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 19 Jun 2009 07:01:34 -0400
Jeff Layton <jlayton@...> wrote:

> On Fri, 19 Jun 2009 08:46:11 +0200
> <pouchat@...> wrote:
>
> > > On Thu, 18 Jun 2009 11:31:30 -0400, Jeff Layton <jlayton@...>
> > wrote:
> > >
> > > No. Is there some reason you feel the need to pretend that the
> > > directory is writable when it isn't?
> >
> > Yes, because it is writable : my share are ALL WRITABLE for user (username
> > and uid
> > option that i pass during the mount). So 2.6.24 have FOR ME the correct
> > behaviour (perms). During my search i've also found that force the
> > dir_mode to 0000 solve partially my problem : writable, but only for
> > root...
> >
> > Finally, the problem (often) come from microsoft : they use the read only
> > attribut instead of the system attribut. As they discuss in this page
> > http://support.microsoft.com/kb/256614 on readonly bit : "some programs can
> > display errors while trying to write file in this - fake readonly - dir".
> > Maybe the case with cifs in kernel 2.6.26 or later. I've tried the regedit
> > they proprosed and after reload cifs all my shares were mounted with
> > corrects
> > perms : rwxr-xr-x instead of r-x-r-xr-x.
> >
> > So for the moment it works, hope for a long time ;) and thanks for
> > spending time to answer and to help !
>
> (cc'ing Steve)
>
> Thanks for the pointer. This article actually has a little more info:
>
> http://support.microsoft.com/kb/326549/
>
> Here's a key phrase:
>
> "Unlike the Read-only attribute for a file, the Read-only attribute for
> a folder is typically ignored by Windows, Windows components and
> accessories, and other programs."
>
> ...perhaps we need to change this behavior so that the write bit isn't
> cleared on directories with ATTR_READONLY set? What's samba's behavior
> in this regard?
>
> Steve, thoughts?
>
Since it sounds like we should change this behavior, this untested
patch should should correct this behavior. It should apply cleanly on
top of the cifs_iget patchset.

--
Jeff Layton <jlayton@...>


>From 9307c6ca7ead856617a6758a394b1002008a75eb Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@...>
Date: Fri, 19 Jun 2009 08:37:49 -0400
Subject: [PATCH] cifs: when ATTR_READONLY is set, only clear write bits on non-directories

On windows servers, ATTR_READONLY apparently either has no meaning or
serves as some sort of queue to certain applications for unrelated
behavior. This MS kbase article has details:

http://support.microsoft.com/kb/326549/

Don't clear the write bits directory mode when ATTR_READONLY is set.

Reported-by: pouchat@...
Signed-off-by: Jeff Layton <jlayton@...>
---
 fs/cifs/inode.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 9195caf..73d7d3d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -419,11 +419,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
  } else {
  fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode;
  fattr->cf_dtype = DT_REG;
- }
 
- /* clear write bits if ATTR_READONLY is set */
- if (fattr->cf_cifsattrs & ATTR_READONLY)
- fattr->cf_mode &= ~(S_IWUGO);
+ /* clear write bits if ATTR_READONLY is set */
+ if (fattr->cf_cifsattrs & ATTR_READONLY)
+ fattr->cf_mode &= ~(S_IWUGO);
+ }
 
  fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
 
--
1.6.0.6



_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client