sunrpc: Set sk_allocation to GFP_NOFS to avoid using current->task_frag.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2143920 Upstream Status: RHEL only
sk_allocation is used by sk_page_frag() to figure out if it can return current->task_frag or if it should resort to the socket specific page_frag (sk->sk_frag). Some subsystems, like NFS, can't use current->task_frag, because they can be called during memory reclaim, while current->task_frag is already in use. That leads to corruption of the page_frag structure.
By reverting sk_allocation to its default value (GFP_KERNEL), upstream
commit a1231fda ("SUNRPC: Set memalloc_nofs_save() on all
rpciod/xprtiod jobs") made sk_page_frag() unable to realise that NFS
sockets can be used during memory reclaim and thus cannot use
current->task_frag.
Fix this by setting sk->sk_allocation to GFP_NOFS, to explicitely tell sk_page_frag() to use the private sk->sk_frag instead.
All attempts to fix this bug upstream have failed:
- https://lore.kernel.org/netdev/b4d8cb09c913d3e34f853736f3f5628abfd7f4b6.1656699567.git.gnault@redhat.com/
- https://lore.kernel.org/netdev/96a18bd00cbc6cb554603cc0d6ef1c551965b078.1663762494.git.gnault@redhat.com/
- https://lore.kernel.org/linux-nfs/de6d99321d1dcaa2ad456b92b3680aa77c07a747.1665401788.git.gnault@redhat.com/
Fixes: a1231fda ("SUNRPC: Set memalloc_nofs_save() on all rpciod/xprtiod jobs") Signed-off-by: Guillaume Nault gnault@redhat.com