<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/nfsd, branch v3.4.92</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/nfsd?h=v3.4.92</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/nfsd?h=v3.4.92'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2014-06-07T23:02:05Z</updated>
<entry>
<title>nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file</title>
<updated>2014-06-07T23:02:05Z</updated>
<author>
<name>Harshula Jayasuriya</name>
<email>harshula@redhat.com</email>
</author>
<published>2013-07-23T04:21:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4834ca940bf17fd203487ad93b69276ebff49688'/>
<id>urn:sha1:4834ca940bf17fd203487ad93b69276ebff49688</id>
<content type='text'>
commit e4daf1ffbe6cc3b12aab4d604e627829e93e9914 upstream.

The following call chain:
------------------------------------------------------------
nfs4_get_vfs_file
- nfsd_open
  - dentry_open
    - do_dentry_open
      - __get_file_write_access
        - get_write_access
          - return atomic_inc_unless_negative(&amp;inode-&gt;i_writecount) ? 0 : -ETXTBSY;
------------------------------------------------------------

can result in the following state:
------------------------------------------------------------
struct nfs4_file {
...
  fi_fds = {0xffff880c1fa65c80, 0xffffffffffffffe6, 0x0},
  fi_access = {{
      counter = 0x1
    }, {
      counter = 0x0
    }},
...
------------------------------------------------------------

1) First time around, in nfs4_get_vfs_file() fp-&gt;fi_fds[O_WRONLY] is
NULL, hence nfsd_open() is called where we get status set to an error
and fp-&gt;fi_fds[O_WRONLY] to -ETXTBSY. Thus we do not reach
nfs4_file_get_access() and fi_access[O_WRONLY] is not incremented.

2) Second time around, in nfs4_get_vfs_file() fp-&gt;fi_fds[O_WRONLY] is
NOT NULL (-ETXTBSY), so nfsd_open() is NOT called, but
nfs4_file_get_access() IS called and fi_access[O_WRONLY] is incremented.
Thus we leave a landmine in the form of the nfs4_file data structure in
an incorrect state.

3) Eventually, when __nfs4_file_put_access() is called it finds
fi_access[O_WRONLY] being non-zero, it decrements it and calls
nfs4_file_put_fd() which tries to fput -ETXTBSY.
------------------------------------------------------------
...
     [exception RIP: fput+0x9]
     RIP: ffffffff81177fa9  RSP: ffff88062e365c90  RFLAGS: 00010282
     RAX: ffff880c2b3d99cc  RBX: ffff880c2b3d9978  RCX: 0000000000000002
     RDX: dead000000100101  RSI: 0000000000000001  RDI: ffffffffffffffe6
     RBP: ffff88062e365c90   R8: ffff88041fe797d8   R9: ffff88062e365d58
     R10: 0000000000000008  R11: 0000000000000000  R12: 0000000000000001
     R13: 0000000000000007  R14: 0000000000000000  R15: 0000000000000000
     ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
  #9 [ffff88062e365c98] __nfs4_file_put_access at ffffffffa0562334 [nfsd]
 #10 [ffff88062e365cc8] nfs4_file_put_access at ffffffffa05623ab [nfsd]
 #11 [ffff88062e365ce8] free_generic_stateid at ffffffffa056634d [nfsd]
 #12 [ffff88062e365d18] release_open_stateid at ffffffffa0566e4b [nfsd]
 #13 [ffff88062e365d38] nfsd4_close at ffffffffa0567401 [nfsd]
 #14 [ffff88062e365d88] nfsd4_proc_compound at ffffffffa0557f28 [nfsd]
 #15 [ffff88062e365dd8] nfsd_dispatch at ffffffffa054543e [nfsd]
 #16 [ffff88062e365e18] svc_process_common at ffffffffa04ba5a4 [sunrpc]
 #17 [ffff88062e365e98] svc_process at ffffffffa04babe0 [sunrpc]
 #18 [ffff88062e365eb8] nfsd at ffffffffa0545b62 [nfsd]
 #19 [ffff88062e365ee8] kthread at ffffffff81090886
 #20 [ffff88062e365f48] kernel_thread at ffffffff8100c14a
------------------------------------------------------------


Signed-off-by: Harshula Jayasuriya &lt;harshula@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
[xr: Backported to 3.4: adjust context]
Signed-off-by: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nfsd: don't run get_file if nfs4_preprocess_stateid_op return error</title>
<updated>2014-06-07T23:02:05Z</updated>
<author>
<name>fanchaoting</name>
<email>fanchaoting@cn.fujitsu.com</email>
</author>
<published>2013-04-01T13:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=79854e6ee54195b89217e72fb0443c49e158c3bd'/>
<id>urn:sha1:79854e6ee54195b89217e72fb0443c49e158c3bd</id>
<content type='text'>
commit b022032e195ffca83d7002d6b84297d796ed443b upstream.

we should return error status directly when nfs4_preprocess_stateid_op
return error.

Signed-off-by: fanchaoting &lt;fanchaoting@cn.fujitsu.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: fix xdr decoding of large non-write compounds</title>
<updated>2014-06-07T23:02:04Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2013-11-19T22:32:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ca36e74e1b126d0e02987a23bbe0b59922f4c548'/>
<id>urn:sha1:ca36e74e1b126d0e02987a23bbe0b59922f4c548</id>
<content type='text'>
commit 365da4adebb1c012febf81019ad3dc5bb52e2a13 upstream.

This fixes a regression from 247500820ebd02ad87525db5d9b199e5b66f6636
"nfsd4: fix decoding of compounds across page boundaries".  The previous
code was correct: argp-&gt;pagelist is initialized in
nfs4svc_deocde_compoundargs to rqstp-&gt;rq_arg.pages, and is therefore a
pointer to the page *after* the page we are currently decoding.

The reason that patch nevertheless fixed a problem with decoding
compounds containing write was a bug in the write decoding introduced by
5a80a54d21c96590d013378d8c5f65f879451ab4 "nfsd4: reorganize write
decoding", after which write decoding no longer adhered to the rule that
argp-&gt;pagelist point to the next page.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
[bwh: Backported to 3.2: adjust context; there is only one instance to fix]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: remove lockowner when removing lock stateid</title>
<updated>2014-06-07T23:02:03Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-05-20T19:55:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a18e4c1145390fbedb21fd805dd1f155172d628a'/>
<id>urn:sha1:a18e4c1145390fbedb21fd805dd1f155172d628a</id>
<content type='text'>
commit a1b8ff4c97b4375d21b6d6c45d75877303f61b3b upstream.

The nfsv4 state code has always assumed a one-to-one correspondance
between lock stateid's and lockowners even if it appears not to in some
places.

We may actually change that, but for now when FREE_STATEID releases a
lock stateid it also needs to release the parent lockowner.

Symptoms were a subsequent LOCK crashing in find_lockowner_str when it
calls same_lockowner_ino on a lockowner that unexpectedly has an empty
so_stateids list.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: warn on finding lockowner without stateid's</title>
<updated>2014-06-07T23:02:03Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-05-08T15:19:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d9eea1ccc7008c95043ad4076e50edeb37f1e865'/>
<id>urn:sha1:d9eea1ccc7008c95043ad4076e50edeb37f1e865</id>
<content type='text'>
commit 27b11428b7de097c42f205beabb1764f4365443b upstream.

The current code assumes a one-to-one lockowner&lt;-&gt;lock stateid
correspondance.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>NFSD: Call -&gt;set_acl with a NULL ACL structure if no entries</title>
<updated>2014-06-07T23:02:03Z</updated>
<author>
<name>Kinglong Mee</name>
<email>kinglongmee@gmail.com</email>
</author>
<published>2014-04-18T12:49:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6ba3ac4483f506394dd096eb7d06b4b10ce061c2'/>
<id>urn:sha1:6ba3ac4483f506394dd096eb7d06b4b10ce061c2</id>
<content type='text'>
commit aa07c713ecfc0522916f3cd57ac628ea6127c0ec upstream.

After setting ACL for directory, I got two problems that caused
by the cached zero-length default posix acl.

This patch make sure nfsd4_set_nfs4_acl calls -&gt;set_acl
with a NULL ACL structure if there are no entries.

Thanks for Christoph Hellwig's advice.

First problem:
............ hang ...........

Second problem:
[ 1610.167668] ------------[ cut here ]------------
[ 1610.168320] kernel BUG at /root/nfs/linux/fs/nfsd/nfs4acl.c:239!
[ 1610.168320] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
[ 1610.168320] Modules linked in: nfsv4(OE) nfs(OE) nfsd(OE)
rpcsec_gss_krb5 fscache ip6t_rpfilter ip6t_REJECT cfg80211 xt_conntrack
rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables
ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6
ip6table_mangle ip6table_security ip6table_raw ip6table_filter
ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4
nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw
auth_rpcgss nfs_acl snd_intel8x0 ppdev lockd snd_ac97_codec ac97_bus
snd_pcm snd_timer e1000 pcspkr parport_pc snd parport serio_raw joydev
i2c_piix4 sunrpc(OE) microcode soundcore i2c_core ata_generic pata_acpi
[last unloaded: nfsd]
[ 1610.168320] CPU: 0 PID: 27397 Comm: nfsd Tainted: G           OE
3.15.0-rc1+ #15
[ 1610.168320] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[ 1610.168320] task: ffff88005ab653d0 ti: ffff88005a944000 task.ti:
ffff88005a944000
[ 1610.168320] RIP: 0010:[&lt;ffffffffa034d5ed&gt;]  [&lt;ffffffffa034d5ed&gt;]
_posix_to_nfsv4_one+0x3cd/0x3d0 [nfsd]
[ 1610.168320] RSP: 0018:ffff88005a945b00  EFLAGS: 00010293
[ 1610.168320] RAX: 0000000000000001 RBX: ffff88006700bac0 RCX:
0000000000000000
[ 1610.168320] RDX: 0000000000000000 RSI: ffff880067c83f00 RDI:
ffff880068233300
[ 1610.168320] RBP: ffff88005a945b48 R08: ffffffff81c64830 R09:
0000000000000000
[ 1610.168320] R10: ffff88004ea85be0 R11: 000000000000f475 R12:
ffff880068233300
[ 1610.168320] R13: 0000000000000003 R14: 0000000000000002 R15:
ffff880068233300
[ 1610.168320] FS:  0000000000000000(0000) GS:ffff880077800000(0000)
knlGS:0000000000000000
[ 1610.168320] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1610.168320] CR2: 00007f5bcbd3b0b9 CR3: 0000000001c0f000 CR4:
00000000000006f0
[ 1610.168320] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 1610.168320] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[ 1610.168320] Stack:
[ 1610.168320]  ffffffff00000000 0000000b67c83500 000000076700bac0
0000000000000000
[ 1610.168320]  ffff88006700bac0 ffff880068233300 ffff88005a945c08
0000000000000002
[ 1610.168320]  0000000000000000 ffff88005a945b88 ffffffffa034e2d5
000000065a945b68
[ 1610.168320] Call Trace:
[ 1610.168320]  [&lt;ffffffffa034e2d5&gt;] nfsd4_get_nfs4_acl+0x95/0x150 [nfsd]
[ 1610.168320]  [&lt;ffffffffa03400d6&gt;] nfsd4_encode_fattr+0x646/0x1e70 [nfsd]
[ 1610.168320]  [&lt;ffffffff816a6e6e&gt;] ? kmemleak_alloc+0x4e/0xb0
[ 1610.168320]  [&lt;ffffffffa0327962&gt;] ?
nfsd_setuser_and_check_port+0x52/0x80 [nfsd]
[ 1610.168320]  [&lt;ffffffff812cd4bb&gt;] ? selinux_cred_prepare+0x1b/0x30
[ 1610.168320]  [&lt;ffffffffa0341caa&gt;] nfsd4_encode_getattr+0x5a/0x60 [nfsd]
[ 1610.168320]  [&lt;ffffffffa0341e07&gt;] nfsd4_encode_operation+0x67/0x110
[nfsd]
[ 1610.168320]  [&lt;ffffffffa033844d&gt;] nfsd4_proc_compound+0x21d/0x810 [nfsd]
[ 1610.168320]  [&lt;ffffffffa0324d9b&gt;] nfsd_dispatch+0xbb/0x200 [nfsd]
[ 1610.168320]  [&lt;ffffffffa00850cd&gt;] svc_process_common+0x46d/0x6d0 [sunrpc]
[ 1610.168320]  [&lt;ffffffffa0085433&gt;] svc_process+0x103/0x170 [sunrpc]
[ 1610.168320]  [&lt;ffffffffa032472f&gt;] nfsd+0xbf/0x130 [nfsd]
[ 1610.168320]  [&lt;ffffffffa0324670&gt;] ? nfsd_destroy+0x80/0x80 [nfsd]
[ 1610.168320]  [&lt;ffffffff810a5202&gt;] kthread+0xd2/0xf0
[ 1610.168320]  [&lt;ffffffff810a5130&gt;] ? insert_kthread_work+0x40/0x40
[ 1610.168320]  [&lt;ffffffff816c1ebc&gt;] ret_from_fork+0x7c/0xb0
[ 1610.168320]  [&lt;ffffffff810a5130&gt;] ? insert_kthread_work+0x40/0x40
[ 1610.168320] Code: 78 02 e9 e7 fc ff ff 31 c0 31 d2 31 c9 66 89 45 ce
41 8b 04 24 66 89 55 d0 66 89 4d d2 48 8d 04 80 49 8d 5c 84 04 e9 37 fd
ff ff &lt;0f&gt; 0b 90 0f 1f 44 00 00 55 8b 56 08 c7 07 00 00 00 00 8b 46 0c
[ 1610.168320] RIP  [&lt;ffffffffa034d5ed&gt;] _posix_to_nfsv4_one+0x3cd/0x3d0
[nfsd]
[ 1610.168320]  RSP &lt;ffff88005a945b00&gt;
[ 1610.257313] ---[ end trace 838254e3e352285b ]---

Signed-off-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: fix setclientid encode size</title>
<updated>2014-05-06T14:51:42Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-03-10T18:17:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d8992efff2b60c8b360ebef7daa03db6496cc131'/>
<id>urn:sha1:d8992efff2b60c8b360ebef7daa03db6496cc131</id>
<content type='text'>
commit 480efaee085235bb848f1063f959bf144103c342 upstream.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd: notify_change needs elevated write count</title>
<updated>2014-05-06T14:51:42Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-02-24T19:59:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=367bce496469f4a47c717c048116cdb73caefa62'/>
<id>urn:sha1:367bce496469f4a47c717c048116cdb73caefa62</id>
<content type='text'>
commit 9f67f189939eccaa54f3d2c9cf10788abaf2d584 upstream.

Looks like this bug has been here since these write counts were
introduced, not sure why it was just noticed now.

Thanks also to Jan Kara for pointing out the problem.

Reported-by: Matthew Rahtz &lt;mrahtz@rapitasystems.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: fix test_stateid error reply encoding</title>
<updated>2014-05-06T14:51:42Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-02-03T21:31:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c2189c7fedb781f3dd14b4df162661e36a85cc02'/>
<id>urn:sha1:c2189c7fedb781f3dd14b4df162661e36a85cc02</id>
<content type='text'>
commit a11fcce1544df08c723d950ff0edef3adac40405 upstream.

If the entire operation fails then there's nothing to encode.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>nfsd4: buffer-length check for SUPPATTR_EXCLCREAT</title>
<updated>2014-05-06T14:51:42Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2014-01-28T21:05:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9acc531f6038cccb95a7bf4d26469196764e6d53'/>
<id>urn:sha1:9acc531f6038cccb95a7bf4d26469196764e6d53</id>
<content type='text'>
commit de3997a7eeb9ea286b15879fdf8a95aae065b4f7 upstream.

This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39
"nfsd41: SUPPATTR_EXCLCREAT attribute".

Cc: Benny Halevy &lt;bhalevy@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
