<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pm24.git/fs/cifs, branch v5.6</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>https://git.kobert.dev/pm24.git/atom/fs/cifs?h=v5.6</id>
<link rel='self' href='https://git.kobert.dev/pm24.git/atom/fs/cifs?h=v5.6'/>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/'/>
<updated>2020-03-19T17:19:11Z</updated>
<entry>
<title>Merge tag '5.6-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6</title>
<updated>2020-03-19T17:19:11Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-03-19T17:19:11Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=cd607737f3b84432b8a00cd31ac753dab1c38678'/>
<id>urn:sha1:cd607737f3b84432b8a00cd31ac753dab1c38678</id>
<content type='text'>
Pull cifs fixes from Steve French:
 "Three small smb3 fixes, two for stable"

* tag '5.6-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  CIFS: fiemap: do not return EINVAL if get nothing
  CIFS: Increment num_remote_opens stats counter even in case of smb2_query_dir_first
  cifs: potential unintitliazed error code in cifs_getattr()
</content>
</entry>
<entry>
<title>locks: reinstate locks_delete_block optimization</title>
<updated>2020-03-18T20:03:38Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-03-18T11:52:21Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=dcf23ac3e846ca0cf626c155a0e3fcbbcf4fae8a'/>
<id>urn:sha1:dcf23ac3e846ca0cf626c155a0e3fcbbcf4fae8a</id>
<content type='text'>
There is measurable performance impact in some synthetic tests due to
commit 6d390e4b5d48 (locks: fix a potential use-after-free problem when
wakeup a waiter). Fix the race condition instead by clearing the
fl_blocker pointer after the wake_up, using explicit acquire/release
semantics.

This does mean that we can no longer use the clearing of fl_blocker as
the wait condition, so switch the waiters over to checking whether the
fl_blocked_member list_head is empty.

Reviewed-by: yangerkun &lt;yangerkun@huawei.com&gt;
Reviewed-by: NeilBrown &lt;neilb@suse.de&gt;
Fixes: 6d390e4b5d48 (locks: fix a potential use-after-free problem when wakeup a waiter)
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>CIFS: fiemap: do not return EINVAL if get nothing</title>
<updated>2020-03-17T18:27:06Z</updated>
<author>
<name>Murphy Zhou</name>
<email>jencce.kernel@gmail.com</email>
</author>
<published>2020-03-14T03:38:31Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=979a2665eb6c603ddce0ab374041ab101827b2e7'/>
<id>urn:sha1:979a2665eb6c603ddce0ab374041ab101827b2e7</id>
<content type='text'>
If we call fiemap on a truncated file with none blocks allocated,
it makes sense we get nothing from this call. No output means
no blocks have been counted, but the call succeeded. It's a valid
response.

Simple example reproducer:
xfs_io -f 'truncate 2M' -c 'fiemap -v' /cifssch/testfile
xfs_io: ioctl(FS_IOC_FIEMAP) ["/cifssch/testfile"]: Invalid argument

Signed-off-by: Murphy Zhou &lt;jencce.kernel@gmail.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
CC: Stable &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>CIFS: Increment num_remote_opens stats counter even in case of smb2_query_dir_first</title>
<updated>2020-03-17T18:27:03Z</updated>
<author>
<name>Shyam Prasad N</name>
<email>nspmangalore@gmail.com</email>
</author>
<published>2020-03-09T08:35:09Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=1be1fa42ebb73ad8fd67d2c846931361b4e3dd0a'/>
<id>urn:sha1:1be1fa42ebb73ad8fd67d2c846931361b4e3dd0a</id>
<content type='text'>
The num_remote_opens counter keeps track of the number of open files which must be
maintained by the server at any point. This is a per-tree-connect counter, and the value
of this counter gets displayed in the /proc/fs/cifs/Stats output as a following...

Open files: 0 total (local), 1 open on server
                             ^^^^^^^^^^^^^^^^
As a thumb-rule, we want to increment this counter for each open/create that we
successfully execute on the server. Similarly, we should decrement the counter when
we successfully execute a close.

In this case, an increment was being missed in case of smb2_query_dir_first,
in case of successful open. As a result, we would underflow the counter and we
could even see the counter go to negative after sufficient smb2_query_dir_first calls.

I tested the stats counter for a bunch of filesystem operations with the fix.
And it looks like the counter looks correct to me.

I also check if we missed the increments and decrements elsewhere. It does not
seem so. Few other cases where an open is done and we don't increment the counter are
the compound calls where the corresponding close is also sent in the request.

Signed-off-by: Shyam Prasad N &lt;nspmangalore@gmail.com&gt;
CC: Stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Reviewed-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: potential unintitliazed error code in cifs_getattr()</title>
<updated>2020-03-17T18:26:26Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2020-02-28T09:22:59Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=39946886fc865a4c26f1b3ea0805936db2d8986d'/>
<id>urn:sha1:39946886fc865a4c26f1b3ea0805936db2d8986d</id>
<content type='text'>
Smatch complains that "rc" could be uninitialized.

    fs/cifs/inode.c:2206 cifs_getattr() error: uninitialized symbol 'rc'.

Changing it to "return 0;" improves readability as well.

Fixes: cc1baf98c8f6 ("cifs: do not ignore the SYNC flags in getattr")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Acked-by: Ronnie Sahlberg &lt;lsahlber@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2020-03-12T22:51:26Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-03-12T22:51:26Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=807f030b44ccbb26a346df6f6438628315d9ad98'/>
<id>urn:sha1:807f030b44ccbb26a346df6f6438628315d9ad98</id>
<content type='text'>
Pull vfs fixes from Al Viro:
 "A couple of fixes for old crap in -&gt;atomic_open() instances"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  cifs_atomic_open(): fix double-put on late allocation failure
  gfs2_atomic_open(): fix O_EXCL|O_CREAT handling on cold dcache
</content>
</entry>
<entry>
<title>cifs_atomic_open(): fix double-put on late allocation failure</title>
<updated>2020-03-12T22:25:20Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2020-03-12T22:25:20Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=d9a9f4849fe0c9d560851ab22a85a666cddfdd24'/>
<id>urn:sha1:d9a9f4849fe0c9d560851ab22a85a666cddfdd24</id>
<content type='text'>
several iterations of -&gt;atomic_open() calling conventions ago, we
used to need fput() if -&gt;atomic_open() failed at some point after
successful finish_open().  Now (since 2016) it's not needed -
struct file carries enough state to make fput() work regardless
of the point in struct file lifecycle and discarding it on
failure exits in open() got unified.  Unfortunately, I'd missed
the fact that we had an instance of -&gt;atomic_open() (cifs one)
that used to need that fput(), as well as the stale comment in
finish_open() demanding such late failure handling.  Trivially
fixed...

Fixes: fe9ec8291fca "do_last(): take fput() on error after opening to out:"
Cc: stable@kernel.org # v4.7+
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>cifs: Use #define in cifs_dbg</title>
<updated>2020-02-24T20:20:38Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2020-02-21T13:20:45Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=fb4b5f13464c468a9c10ae1ab8ba9aa352d0256a'/>
<id>urn:sha1:fb4b5f13464c468a9c10ae1ab8ba9aa352d0256a</id>
<content type='text'>
All other uses of cifs_dbg use defines so change this one.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: fix rename() by ensuring source handle opened with DELETE bit</title>
<updated>2020-02-24T20:20:38Z</updated>
<author>
<name>Aurelien Aptel</name>
<email>aaptel@suse.com</email>
</author>
<published>2020-02-21T10:19:06Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=86f740f2aed5ea7fe1aa86dc2df0fb4ab0f71088'/>
<id>urn:sha1:86f740f2aed5ea7fe1aa86dc2df0fb4ab0f71088</id>
<content type='text'>
To rename a file in SMB2 we open it with the DELETE access and do a
special SetInfo on it. If the handle is missing the DELETE bit the
server will fail the SetInfo with STATUS_ACCESS_DENIED.

We currently try to reuse any existing opened handle we have with
cifs_get_writable_path(). That function looks for handles with WRITE
access but doesn't check for DELETE, making rename() fail if it finds
a handle to reuse. Simple reproducer below.

To select handles with the DELETE bit, this patch adds a flag argument
to cifs_get_writable_path() and find_writable_file() and the existing
'bool fsuid_only' argument is converted to a flag.

The cifsFileInfo struct only stores the UNIX open mode but not the
original SMB access flags. Since the DELETE bit is not mapped in that
mode, this patch stores the access mask in cifs_fid on file open,
which is accessible from cifsFileInfo.

Simple reproducer:

	#include &lt;stdio.h&gt;
	#include &lt;stdlib.h&gt;
	#include &lt;sys/types.h&gt;
	#include &lt;sys/stat.h&gt;
	#include &lt;fcntl.h&gt;
	#include &lt;unistd.h&gt;
	#define E(s) perror(s), exit(1)

	int main(int argc, char *argv[])
	{
		int fd, ret;
		if (argc != 3) {
			fprintf(stderr, "Usage: %s A B\n"
			"create&amp;open A in write mode, "
			"rename A to B, close A\n", argv[0]);
			return 0;
		}

		fd = openat(AT_FDCWD, argv[1], O_WRONLY|O_CREAT|O_SYNC, 0666);
		if (fd == -1) E("openat()");

		ret = rename(argv[1], argv[2]);
		if (ret) E("rename()");

		ret = close(fd);
		if (ret) E("close()");

		return ret;
	}

$ gcc -o bugrename bugrename.c
$ ./bugrename /mnt/a /mnt/b
rename(): Permission denied

Fixes: 8de9e86c67ba ("cifs: create a helper to find a writeable handle by path name")
CC: Stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
Reviewed-by: Paulo Alcantara (SUSE) &lt;pc@cjr.nz&gt;
</content>
</entry>
<entry>
<title>cifs: add missing mount option to /proc/mounts</title>
<updated>2020-02-24T20:20:38Z</updated>
<author>
<name>Steve French</name>
<email>stfrench@microsoft.com</email>
</author>
<published>2020-02-20T05:59:32Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=ec57010acd03428a749d2600bf09bd537eaae993'/>
<id>urn:sha1:ec57010acd03428a749d2600bf09bd537eaae993</id>
<content type='text'>
We were not displaying the mount option "signloosely" in /proc/mounts
for cifs mounts which some users found confusing recently

Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
</content>
</entry>
</feed>
