<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/fuse, branch v5.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-10-23T12:26:37Z</updated>
<entry>
<title>fuse: redundant get_fuse_inode() calls in fuse_writepages_fill()</title>
<updated>2019-10-23T12:26:37Z</updated>
<author>
<name>Vasily Averin</name>
<email>vvs@virtuozzo.com</email>
</author>
<published>2019-08-19T05:48:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=091d1a7267726ba162b12ce9332d76cdae602789'/>
<id>urn:sha1:091d1a7267726ba162b12ce9332d76cdae602789</id>
<content type='text'>
Currently fuse_writepages_fill() calls get_fuse_inode() few times with
the same argument.

Signed-off-by: Vasily Averin &lt;vvs@virtuozzo.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>fuse: truncate pending writes on O_TRUNC</title>
<updated>2019-10-23T12:26:37Z</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@redhat.com</email>
</author>
<published>2019-10-23T12:26:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e4648309b85a78f8c787457832269a8712a8673e'/>
<id>urn:sha1:e4648309b85a78f8c787457832269a8712a8673e</id>
<content type='text'>
Make sure cached writes are not reordered around open(..., O_TRUNC), with
the obvious wrong results.

Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on")
Cc: &lt;stable@vger.kernel.org&gt; # v3.15+
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>fuse: flush dirty data/metadata before non-truncate setattr</title>
<updated>2019-10-23T12:26:37Z</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@redhat.com</email>
</author>
<published>2019-10-23T12:26:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b24e7598db62386a95a3c8b9c75630c5d56fe077'/>
<id>urn:sha1:b24e7598db62386a95a3c8b9c75630c5d56fe077</id>
<content type='text'>
If writeback cache is enabled, then writes might get reordered with
chmod/chown/utimes.  The problem with this is that performing the write in
the fuse daemon might itself change some of these attributes.  In such case
the following sequence of operations will result in file ending up with the
wrong mode, for example:

  int fd = open ("suid", O_WRONLY|O_CREAT|O_EXCL);
  write (fd, "1", 1);
  fchown (fd, 0, 0);
  fchmod (fd, 04755);
  close (fd);

This patch fixes this by flushing pending writes before performing
chown/chmod/utimes.

Reported-by: Giuseppe Scrivano &lt;gscrivan@redhat.com&gt;
Tested-by: Giuseppe Scrivano &lt;gscrivan@redhat.com&gt;
Fixes: 4d99ff8f12eb ("fuse: Turn writeback cache on")
Cc: &lt;stable@vger.kernel.org&gt; # v3.15+
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: Remove set but not used variable 'fc'</title>
<updated>2019-10-23T08:25:17Z</updated>
<author>
<name>zhengbin</name>
<email>zhengbin13@huawei.com</email>
</author>
<published>2019-10-23T02:02:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=80da5a809d193c60d090cbdf4fe316781bc07965'/>
<id>urn:sha1:80da5a809d193c60d090cbdf4fe316781bc07965</id>
<content type='text'>
Fixes gcc '-Wunused-but-set-variable' warning:

fs/fuse/virtio_fs.c: In function virtio_fs_wake_pending_and_unlock:
fs/fuse/virtio_fs.c:983:20: warning: variable fc set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee1e2e631db ("virtiofs: No need to check
fpq-&gt;connected state")

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: zhengbin &lt;zhengbin13@huawei.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: Retry request submission from worker context</title>
<updated>2019-10-21T13:57:08Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2019-10-15T17:46:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a9bfd9dd3417561d06c81de04f6d6c1e0c9b3d44'/>
<id>urn:sha1:a9bfd9dd3417561d06c81de04f6d6c1e0c9b3d44</id>
<content type='text'>
If regular request queue gets full, currently we sleep for a bit and
retrying submission in submitter's context. This assumes submitter is not
holding any spin lock. But this assumption is not true for background
requests. For background requests, we are called with fc-&gt;bg_lock held.

This can lead to deadlock where one thread is trying submission with
fc-&gt;bg_lock held while request completion thread has called
fuse_request_end() which tries to acquire fc-&gt;bg_lock and gets blocked. As
request completion thread gets blocked, it does not make further progress
and that means queue does not get empty and submitter can't submit more
requests.

To solve this issue, retry submission with the help of a worker, instead of
retrying in submitter's context. We already do this for hiprio/forget
requests.

Reported-by: Chirantan Ekbote &lt;chirantan@chromium.org&gt;
Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: Count pending forgets as in_flight forgets</title>
<updated>2019-10-21T13:57:07Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2019-10-15T17:46:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c17ea009610366146ec409fd6dc277e0f2510b10'/>
<id>urn:sha1:c17ea009610366146ec409fd6dc277e0f2510b10</id>
<content type='text'>
If virtqueue is full, we put forget requests on a list and these forgets
are dispatched later using a worker. As of now we don't count these forgets
in fsvq-&gt;in_flight variable. This means when queue is being drained, we
have to have special logic to first drain these pending requests and then
wait for fsvq-&gt;in_flight to go to zero.

By counting pending forgets in fsvq-&gt;in_flight, we can get rid of special
logic and just wait for in_flight to go to zero. Worker thread will kick
and drain all the forgets anyway, leading in_flight to zero.

I also need similar logic for normal request queue in next patch where I am
about to defer request submission in the worker context if queue is full.

This simplifies the code a bit.

Also add two helper functions to inc/dec in_flight. Decrement in_flight
helper will later used to call completion when in_flight reaches zero.

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: Set FR_SENT flag only after request has been sent</title>
<updated>2019-10-21T13:57:07Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2019-10-15T17:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5dbe190f341206a7896f7e40c1e3a36933d812f3'/>
<id>urn:sha1:5dbe190f341206a7896f7e40c1e3a36933d812f3</id>
<content type='text'>
FR_SENT flag should be set when request has been sent successfully sent
over virtqueue. This is used by interrupt logic to figure out if interrupt
request should be sent or not.

Also add it to fqp-&gt;processing list after sending it successfully.

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: No need to check fpq-&gt;connected state</title>
<updated>2019-10-21T13:57:07Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2019-10-15T17:46:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ee1e2e631dbf0ff0df2a67a1e01ba3c1dce7a46'/>
<id>urn:sha1:7ee1e2e631dbf0ff0df2a67a1e01ba3c1dce7a46</id>
<content type='text'>
In virtiofs we keep per queue connected state in virtio_fs_vq-&gt;connected
and use that to end request if queue is not connected. And virtiofs does
not even touch fpq-&gt;connected state.

We probably need to merge these two at some point of time. For now,
simplify the code a bit and do not worry about checking state of
fpq-&gt;connected.

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtiofs: Do not end request in submission context</title>
<updated>2019-10-21T13:57:07Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2019-10-15T17:46:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=51fecdd2555b3e0e05a78d30093c638d164a32f9'/>
<id>urn:sha1:51fecdd2555b3e0e05a78d30093c638d164a32f9</id>
<content type='text'>
Submission context can hold some locks which end request code tries to hold
again and deadlock can occur. For example, fc-&gt;bg_lock. If a background
request is being submitted, it might hold fc-&gt;bg_lock and if we could not
submit request (because device went away) and tried to end request, then
deadlock happens. During testing, I also got a warning from deadlock
detection code.

So put requests on a list and end requests from a worker thread.

I got following warning from deadlock detector.

[  603.137138] WARNING: possible recursive locking detected
[  603.137142] --------------------------------------------
[  603.137144] blogbench/2036 is trying to acquire lock:
[  603.137149] 00000000f0f51107 (&amp;(&amp;fc-&gt;bg_lock)-&gt;rlock){+.+.}, at: fuse_request_end+0xdf/0x1c0 [fuse]
[  603.140701]
[  603.140701] but task is already holding lock:
[  603.140703] 00000000f0f51107 (&amp;(&amp;fc-&gt;bg_lock)-&gt;rlock){+.+.}, at: fuse_simple_background+0x92/0x1d0 [fuse]
[  603.140713]
[  603.140713] other info that might help us debug this:
[  603.140714]  Possible unsafe locking scenario:
[  603.140714]
[  603.140715]        CPU0
[  603.140716]        ----
[  603.140716]   lock(&amp;(&amp;fc-&gt;bg_lock)-&gt;rlock);
[  603.140718]   lock(&amp;(&amp;fc-&gt;bg_lock)-&gt;rlock);
[  603.140719]
[  603.140719]  *** DEADLOCK ***

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>fuse: don't advise readdirplus for negative lookup</title>
<updated>2019-10-21T13:57:07Z</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@redhat.com</email>
</author>
<published>2019-10-21T13:57:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6c26f71759a6efc04b888dd2c1cc4f1cac38cdf0'/>
<id>urn:sha1:6c26f71759a6efc04b888dd2c1cc4f1cac38cdf0</id>
<content type='text'>
If the FUSE_READDIRPLUS_AUTO feature is enabled, then lookups on a
directory before/during readdir are used as an indication that READDIRPLUS
should be used instead of READDIR.  However if the lookup turns out to be
negative, then selecting READDIRPLUS makes no sense.

Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
</feed>
