Age | Commit message (Collapse) | Author |
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Break up cifs_setattr further by moving the logic that sets file times
and dos attributes into a separate function. This patch also refactors
the logic a bit so that when the file is already open then we go ahead
and do a SetFileInfo call. SetPathInfo seems to be unreliable when
setting times on open files.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Create a new cifs_setattr_unix function to handle a setattr when unix
extensions are enabled and have cifs_setattr call it. Also, clean up
variable declarations in cifs_setattr.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Remove some long lines
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
If a server supports unix extensions but does not support POSIX create
routines, then the client will create a new inode with a standard SMB
mkdir or create/open call and then will set the mode. When it does this,
it does not take the setgid bit on the parent directory into account.
This patch has CIFS flip on the setgid bit when the parent directory has
it. If the share is mounted with "setuids" then also change the group
owner to the gid of the parent.
This patch should apply cleanly on top of the setattr cleanup patches
that I sent a few weeks ago.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
The new name is more clear since this is also used to set file
attributes. We'll need the pid_of_opener arg so that we can
pass in filehandles of other pids and spare ourselves an open
call.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
CIFSSMBSetTimes is a deceptive name. This function does more that just
set file times. Change it to CIFSSMBSetPathInfo, which is closer to its
real purpose.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Jeff left trailing whitespace in previous patch
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
We'd like to be able to use the unix SET_PATH_INFO_BASIC args to set
file times as well, but that makes the argument list rather long. Bundle
up the args for unix SET_PATH_INFO call into a struct. For now, we don't
actually use the times fields anywhere. That will be done in a follow-on
patch.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Fix missing braces introduced during commit
cea218054ad277d6c126890213afde07b4eb1602. Though setting wbrc to 0
keeps this from causing real bug, this should have been there.
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
The global tcpSesAllocCount variable is an atomic already and doesn't
really need the extra locking around it. Remove the locking and just use
the atomic_inc_return and atomic_dec_return functions to make sure we
access it correctly.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
...it doesn't look like it's being accounted for at the moment. Also
try to reorganize the calculation to make it a little more evident
what each piece means.
This should probably go to the stable series as well...
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Most of this function takes place inside of an unnecessary "else"
clause. The other 2 cases both return 0, so we can remove some
indentation here.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
There are cases in which, on a full socket which requires retry on
sending data by the app (cifs in this case), that we were not
retrying since we did not reinitialize a counter.
This fixes the retry logic to retry up to 15 seconds on stuck
sockets.
Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
The oid coming back from asn1_header_decode is a primitive object so
class should be checked to be universal.
Acked-by: Love Hörnquist Åstrand <lha@kth.se>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
* kill nameidata * argument; map the 3 bits in ->flags anybody cares
about to new MAY_... ones and pass with the mask.
* kill redundant gfs2_iop_permission()
* sanitize ecryptfs_permission()
* fix remaining places where ->permission() instances might barf on new
MAY_... found in mask.
The obvious next target in that direction is permission(9)
folded fix for nfs_permission() breakage from Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
When verifying the decoded header before decoding the object identifier
[CIFS] Fix warnings from checkpatch
[CIFS] Fix improper endian conversion of ACL subauth field
[CIFS] Fix possible double free if search immediately after search rewind fails
[CIFS] remove checkpatch warning
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
cifs: assorted endian annotations
[CIFS] break ATTR_SIZE changes out into their own function
lockdep: annotate cifs in-kernel sockets
[CIFS] Fix compiler warning on 64-bit
|
|
Kmem cache passed to constructor is only needed for constructors that are
themselves multiplexeres. Nobody uses this "feature", nor does anybody uses
passed kmem cache in non-trivial way, so pass only pointer to object.
Non-trivial places are:
arch/powerpc/mm/init_64.c
arch/powerpc/mm/hugetlbpage.c
This is flag day, yes.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Jon Tollefson <kniht@linux.vnet.ibm.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Matt Mackall <mpm@selenic.com>
[akpm@linux-foundation.org: fix arch/powerpc/mm/hugetlbpage.c]
[akpm@linux-foundation.org: fix mm/slab.c]
[akpm@linux-foundation.org: fix ubifs]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
(expecting a SPNEGO pseudo-mechanism oid), the test to verify it is a
primitive encoding is compared against the asn1 class. Primitive is not a
class. This brings check in line with similar check for krb/ntlmssp oid.
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
In mode_to_acl when converting a Unix mode to a Windows ACL
the subauth fields of the SID in the ACL were translated
incorrectly on bigendian architectures
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
fs/cifs/cifssmb.c:3917:13: warning: incorrect type in assignment (different base types)
fs/cifs/cifssmb.c:3917:13: expected bool [unsigned] [usertype] is_unicode
fs/cifs/cifssmb.c:3917:13: got restricted __le16
The comment explains why __force is used here.
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Move the code that handles ATTR_SIZE changes to its own function. This
makes for a smaller function and reduces the level of indentation.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Put CIFS sockets in their own class to avoid some lockdep warnings. CIFS
sockets are not exposed to user-space, and so are not subject to the
same deadlock scenarios.
A similar change was made a couple of years ago for RPC sockets in commit
ed07536ed6731775219c1df7fa26a7588753e693.
This patch should prevent lockdep false-positives like this one:
=======================================================
[ INFO: possible circular locking dependency detected ]
2.6.18-98.el5.jtltest.38.bz456320.1debug #1
-------------------------------------------------------
test5/2483 is trying to acquire lock:
(sk_lock-AF_INET){--..}, at: [<ffffffff800270d2>] tcp_sendmsg+0x1c/0xb2f
but task is already holding lock:
(&inode->i_alloc_sem){--..}, at: [<ffffffff8002e454>] notify_change+0xf5/0x2e0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&inode->i_alloc_sem){--..}:
[<ffffffff800a817c>] __lock_acquire+0x9a9/0xadf
[<ffffffff800a8a72>] lock_acquire+0x55/0x70
[<ffffffff8002e454>] notify_change+0xf5/0x2e0
[<ffffffff800a4e36>] down_write+0x3c/0x68
[<ffffffff8002e454>] notify_change+0xf5/0x2e0
[<ffffffff800e358d>] do_truncate+0x50/0x6b
[<ffffffff8005197c>] get_write_access+0x40/0x46
[<ffffffff80012cf1>] may_open+0x1d3/0x22e
[<ffffffff8001bc81>] open_namei+0x2c6/0x6dd
[<ffffffff800289c6>] do_filp_open+0x1c/0x38
[<ffffffff800683ef>] _spin_unlock+0x17/0x20
[<ffffffff800167a7>] get_unused_fd+0xf9/0x107
[<ffffffff8001a704>] do_sys_open+0x44/0xbe
[<ffffffff80060116>] system_call+0x7e/0x83
[<ffffffffffffffff>] 0xffffffffffffffff
-> #2 (&sysfs_inode_imutex_key){--..}:
[<ffffffff800a817c>] __lock_acquire+0x9a9/0xadf
[<ffffffff8010f6df>] create_dir+0x26/0x1d7
[<ffffffff800a8a72>] lock_acquire+0x55/0x70
[<ffffffff8010f6df>] create_dir+0x26/0x1d7
[<ffffffff800671c0>] mutex_lock_nested+0x104/0x29c
[<ffffffff800a819d>] __lock_acquire+0x9ca/0xadf
[<ffffffff8010f6df>] create_dir+0x26/0x1d7
[<ffffffff8010fc67>] sysfs_create_dir+0x58/0x76
[<ffffffff8015144c>] kobject_add+0xdb/0x198
[<ffffffff801be765>] class_device_add+0xb2/0x465
[<ffffffff8005a6ff>] kobject_get+0x12/0x17
[<ffffffff80225265>] register_netdevice+0x270/0x33e
[<ffffffff8022538c>] register_netdev+0x59/0x67
[<ffffffff80464d40>] net_olddevs_init+0xb/0xac
[<ffffffff80448a79>] init+0x1f9/0x2fc
[<ffffffff80068885>] _spin_unlock_irq+0x24/0x27
[<ffffffff80067f86>] trace_hardirqs_on_thunk+0x35/0x37
[<ffffffff80061079>] child_rip+0xa/0x11
[<ffffffff80068885>] _spin_unlock_irq+0x24/0x27
[<ffffffff800606a8>] restore_args+0x0/0x30
[<ffffffff80179a59>] acpi_ds_init_one_object+0x0/0x80
[<ffffffff80448880>] init+0x0/0x2fc
[<ffffffff8006106f>] child_rip+0x0/0x11
[<ffffffffffffffff>] 0xffffffffffffffff
-> #1 (rtnl_mutex){--..}:
[<ffffffff800a817c>] __lock_acquire+0x9a9/0xadf
[<ffffffff8025acf8>] ip_mc_leave_group+0x23/0xb7
[<ffffffff800a8a72>] lock_acquire+0x55/0x70
[<ffffffff8025acf8>] ip_mc_leave_group+0x23/0xb7
[<ffffffff800671c0>] mutex_lock_nested+0x104/0x29c
[<ffffffff8025acf8>] ip_mc_leave_group+0x23/0xb7
[<ffffffff802451b0>] do_ip_setsockopt+0x6d1/0x9bf
[<ffffffff800a575e>] lock_release_holdtime+0x27/0x48
[<ffffffff800a575e>] lock_release_holdtime+0x27/0x48
[<ffffffff8006a85e>] do_page_fault+0x503/0x835
[<ffffffff8012cbf6>] socket_has_perm+0x5b/0x68
[<ffffffff80245556>] ip_setsockopt+0x22/0x78
[<ffffffff8021c973>] sys_setsockopt+0x91/0xb7
[<ffffffff800602a6>] tracesys+0xd5/0xdf
[<ffffffffffffffff>] 0xffffffffffffffff
-> #0 (sk_lock-AF_INET){--..}:
[<ffffffff800a5037>] print_stack_trace+0x59/0x68
[<ffffffff800a8092>] __lock_acquire+0x8bf/0xadf
[<ffffffff800a8a72>] lock_acquire+0x55/0x70
[<ffffffff800270d2>] tcp_sendmsg+0x1c/0xb2f
[<ffffffff80035466>] lock_sock+0xd4/0xe4
[<ffffffff80096e91>] _local_bh_enable+0xcb/0xe0
[<ffffffff800606a8>] restore_args+0x0/0x30
[<ffffffff800270d2>] tcp_sendmsg+0x1c/0xb2f
[<ffffffff80057540>] sock_sendmsg+0xf3/0x110
[<ffffffff800a2bb6>] autoremove_wake_function+0x0/0x2e
[<ffffffff800a10e4>] kernel_text_address+0x1a/0x26
[<ffffffff8006f4e2>] dump_trace+0x211/0x23a
[<ffffffff800a6d3d>] find_usage_backwards+0x5f/0x88
[<ffffffff8840221a>] MD5Final+0xaf/0xc2 [cifs]
[<ffffffff884032ec>] cifs_calculate_signature+0x55/0x69 [cifs]
[<ffffffff8021d891>] kernel_sendmsg+0x35/0x47
[<ffffffff883ff38e>] smb_send+0xa3/0x151 [cifs]
[<ffffffff883ff5de>] SendReceive+0x1a2/0x448 [cifs]
[<ffffffff800a812f>] __lock_acquire+0x95c/0xadf
[<ffffffff883e758a>] CIFSSMBSetEOF+0x20d/0x25b [cifs]
[<ffffffff883fa430>] cifs_set_file_size+0x110/0x3b7 [cifs]
[<ffffffff883faa89>] cifs_setattr+0x3b2/0x6f6 [cifs]
[<ffffffff8002e454>] notify_change+0xf5/0x2e0
[<ffffffff8002e4a4>] notify_change+0x145/0x2e0
[<ffffffff800e358d>] do_truncate+0x50/0x6b
[<ffffffff8005197c>] get_write_access+0x40/0x46
[<ffffffff80012cf1>] may_open+0x1d3/0x22e
[<ffffffff8001bc81>] open_namei+0x2c6/0x6dd
[<ffffffff800289c6>] do_filp_open+0x1c/0x38
[<ffffffff800683ef>] _spin_unlock+0x17/0x20
[<ffffffff800167a7>] get_unused_fd+0xf9/0x107
[<ffffffff8001a704>] do_sys_open+0x44/0xbe
[<ffffffff800602a6>] tracesys+0xd5/0xdf
[<ffffffffffffffff>] 0xffffffffffffffff
other info that might help us debug this:
2 locks held by test5/2483:
#0: (&inode->i_mutex){--..}, at: [<ffffffff800e3582>] do_truncate+0x45/0x6b
#1: (&inode->i_alloc_sem){--..}, at: [<ffffffff8002e454>] notify_change+0xf5/0x2e0
stack backtrace:
Call Trace:
[<ffffffff800a6a7b>] print_circular_bug_tail+0x65/0x6e
[<ffffffff800a5037>] print_stack_trace+0x59/0x68
[<ffffffff800a8092>] __lock_acquire+0x8bf/0xadf
[<ffffffff800a8a72>] lock_acquire+0x55/0x70
[<ffffffff800270d2>] tcp_sendmsg+0x1c/0xb2f
[<ffffffff80035466>] lock_sock+0xd4/0xe4
[<ffffffff80096e91>] _local_bh_enable+0xcb/0xe0
[<ffffffff800606a8>] restore_args+0x0/0x30
[<ffffffff800270d2>] tcp_sendmsg+0x1c/0xb2f
[<ffffffff80057540>] sock_sendmsg+0xf3/0x110
[<ffffffff800a2bb6>] autoremove_wake_function+0x0/0x2e
[<ffffffff800a10e4>] kernel_text_address+0x1a/0x26
[<ffffffff8006f4e2>] dump_trace+0x211/0x23a
[<ffffffff800a6d3d>] find_usage_backwards+0x5f/0x88
[<ffffffff8840221a>] :cifs:MD5Final+0xaf/0xc2
[<ffffffff884032ec>] :cifs:cifs_calculate_signature+0x55/0x69
[<ffffffff8021d891>] kernel_sendmsg+0x35/0x47
[<ffffffff883ff38e>] :cifs:smb_send+0xa3/0x151
[<ffffffff883ff5de>] :cifs:SendReceive+0x1a2/0x448
[<ffffffff800a812f>] __lock_acquire+0x95c/0xadf
[<ffffffff883e758a>] :cifs:CIFSSMBSetEOF+0x20d/0x25b
[<ffffffff883fa430>] :cifs:cifs_set_file_size+0x110/0x3b7
[<ffffffff883faa89>] :cifs:cifs_setattr+0x3b2/0x6f6
[<ffffffff8002e454>] notify_change+0xf5/0x2e0
[<ffffffff8002e4a4>] notify_change+0x145/0x2e0
[<ffffffff800e358d>] do_truncate+0x50/0x6b
[<ffffffff8005197c>] get_write_access+0x40/0x46
[<ffffffff80012cf1>] may_open+0x1d3/0x22e
[<ffffffff8001bc81>] open_namei+0x2c6/0x6dd
[<ffffffff800289c6>] do_filp_open+0x1c/0x38
[<ffffffff800683ef>] _spin_unlock+0x17/0x20
[<ffffffff800167a7>] get_unused_fd+0xf9/0x107
[<ffffffff8001a704>] do_sys_open+0x44/0xbe
[<ffffffff800602a6>] tracesys+0xd5/0xdf
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
|
|
The current definition of wksidarr works fine on little endian arches
(since cpu_to_le32 is a no-op there), but on big-endian arches, it fails
to compile with this error:
error: braced-group within expression allowed only inside a function
The problem is that this static declaration has cpu_to_le32 embedded
within it, and that expands into a function macro. We need to use
__constant_cpu_to_le32() instead.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Steven French <sfrench@us.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
Try this:
mount a share with unix extensions
create a file on it
umount the share
You'll get the following message in the ring buffer:
VFS: Busy inodes after unmount of cifs. Self-destruct in 5 seconds. Have a
nice day...
...the problem is that cifs_get_inode_info_unix is creating and hashing
a new inode even when it's going to return error anyway. The first
lookup when creating a file returns an error so we end up leaking this
inode before we do the actual create. This appears to be a regression
caused by commit 0e4bbde94fdc33f5b3d793166b21bf768ca3e098.
The following patch seems to fix it for me, and fixes a minor
formatting nit as well.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
- Replace remote_llseek with generic_file_llseek_unlocked (to force compilation
failures in all users)
- Change all users to either use generic_file_llseek_unlocked directly or
take the BKL around. I changed the file systems who don't use the BKL
for anything (CIFS, GFS) to call it directly. NCPFS and SMBFS and NFS
take the BKL, but explicitely in their own source now.
I moved them all over in a single patch to avoid unbisectable sections.
Open problem: 32bit kernels can corrupt fpos because its modification
is not atomic, but they can do that anyways because there's other paths who
modify it without BKL.
Do we need a special lock for the pos/f_version = 0 checks?
Trond says the NFS BKL is likely not needed, but keep it for now
until his full audit.
v2: Use generic_file_llseek_unlocked instead of remote_llseek_unlocked
and factor duplicated code (suggested by hch)
Cc: Trond.Myklebust@netapp.com
Cc: swhiteho@redhat.com
Cc: sfrench@samba.org
Cc: vandrove@vc.cvut.cz
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
|
|
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] cifs: fix oops on mount when CONFIG_CIFS_DFS_UPCALL is enabled
[CIFS] Fix hang in mount when negprot causes server to kill tcp session
disable most mode changes on non-unix/non-cifsacl mounts
[CIFS] Correct incorrect obscure open flag
[CIFS] warn if both dynperm and cifsacl mount options specified
silently ignore ownership changes unless unix extensions are enabled or we're faking uid changes
[CIFS] remove trailing whitespace
when creating new inodes, use file_mode/dir_mode exclusively on mount without unix extensions
on non-posix shares, clear write bits in mode when ATTR_READONLY is set
[CIFS] remove unused variables
|
|
simple "mount -t cifs //xxx /mnt" oopsed on strlen of options
http://kerneloops.org/guilty.php?guilty=cifs_get_sb&version=2.6.25-release&start=16711 \
68&end=1703935&class=oops
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
- Don't trust a length which is greater than the working buffer.
An invalid length could cause overflow when calculating buffer size
for decoding oid.
- An oid length of zero is invalid and allows for an off-by-one error when
decoding oid because the first subid actually encodes first 2 subids.
- A primitive encoding may not have an indefinite length.
Thanks to Wei Wang from McAfee for report.
Cc: Steven French <sfrench@us.ibm.com>
Cc: stable@kernel.org
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
__le16 fields used as host-endian.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Steve French <smfrench@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
CIFS currently allows you to change the mode of an inode on a share that
doesn't have unix extensions enabled, and isn't using cifsacl. The inode
in this case *only* has its mode changed in memory on the client. This
is problematic since it can change any time the inode is purged from the
cache.
This patch makes cifs_setattr silently ignore most mode changes when
unix extensions and cifsacl support are not enabled, and when the share
is not mounted with the "dynperm" option. The exceptions are:
When a mode change would remove all write access to an inode we turn on
the ATTR_READONLY bit on the server and remove all write bits from the
inode's mode in memory.
When a mode change would add a write bit to an inode that previously had
them all turned off, it turns off the ATTR_READONLY bit on the server,
and resets the mode back to what it would normally be (generally, the
file_mode or dir_mode of the share).
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Also add defines for pipe subcommand codes
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
we're faking uid changes
CIFS currently allows you to change the ownership of a file, but unless
unix extensions are enabled this change is not passed off to the server.
Have CIFS silently ignore ownership changes that can't be persistently
stored on the server unless the "setuids" option is explicitly
specified.
We could return an error here (-EOPNOTSUPP or something), but this is
how most disk-based windows filesystems on behave on Linux (e.g. VFAT,
NTFS, etc). With cifsacl support and proper Windows to Unix idmapping
support, we may be able to do this more properly in the future.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
without unix extensions
When CIFS creates a new inode on a mount without unix extensions, it
temporarily assigns the mode that was passed to it in the create/mkdir
call. Eventually, when the inode is revalidated, it changes to have the
file_mode or dir_mode for the mount. This is confusing to users who
expect that the mode shouldn't change this way. It's also problematic
since only the mode is treated this way, not the uid or gid. Suppose you
have a CIFS mount that's mounted with:
uid=0,gid=0,file_mode=0666,dir_mode=0777
...if an unprivileged user comes along and does this on the mount:
mkdir -m 0700 foo
touch foo/bar
...there is a period of time where the touch will fail, since the dir
will initially be owned by root and have mode 0700. If the user waits
long enough, then "foo" will be revalidated and will get the correct
dir_mode permissions.
This patch changes cifs_mkdir and cifs_create to not overwrite the
mode found by the initial cifs_get_inode_info call after the inode is
created on the server. Legacy behavior can be reenabled with the
new "dynperm" mount option.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
When mounting a share with posix extensions disabled,
cifs_get_inode_info turns off all the write bits in the mode for regular
files if ATTR_READONLY is set. Directories and other inode types,
however, can also have ATTR_READONLY set, but the mode gives no
indication of this.
This patch makes this apply to other inode types besides regular files.
It also cleans up how modes are set in cifs_get_inode_info for both the
"normal" and "dynperm" cases.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
CC: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Noticed by Coverity checker.
Signed-off-by: Steve French <sfrench@us.ibm.com>
|
|
Signed-off-by: Steve French <sfrench@us.ibm.com>
|