LINUX 5.14: explicitly set set_page_dirty to default 26/14826/2
authorCheyenne Wills <cwills@sinenomine.net>
Thu, 7 Oct 2021 17:15:58 +0000 (11:15 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 12 Oct 2021 18:57:05 +0000 (14:57 -0400)
Linux 5.14 commit: 'mm: require ->set_page_dirty to be explicitly wired
up' (0af573780b0b13) removed calling __set_page_dirty_buffers when the
address_space_operations structure member set_page_dirty was NULL.

A kernel RIP error can occur when the set_page_dirty operation is
requested. (Reproducible by running 'iozone -B -a')

Update the definition for afs_file_aops to explicitly set the
'set_page_dirty' member to '__set_page_dirty_buffers'.

There are no functional changes, since this commit is using the same
function that the Linux kernel was using if set_page_dirty had been
NULL.

Problem originally reported by "Andrej Filipcic"
<andrej.filipcic@ijs.si> in the openafs-info mailing list.  The Linux
5.14 commit causing the openafs failure was identified by "Michael Laß"
<lass@mail.upb.de> also on in the openafs-info mailing list.

Note: The declaration for the function '__set_page_dirty_buffers' was
moved from linux/mm.h into linux/buffer_head.h in Linux 2.6.19.  Since
this is close to the minimum supported Linux version 2.6.18, we are not
introducing an additional autoconf test to determine which header file
the declaration for __set_page_dirty_buffers resides in.

Change-Id: I8f2a00e374635ab1aa69d6eaef8cf97bb449d089
Reviewed-on: https://gerrit.openafs.org/14826
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Tested-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/LINUX/osi_vnodeops.c

index ac0c33d..15258ee 100644 (file)
@@ -26,6 +26,7 @@
 #include "afsincludes.h"
 #include "afs/afs_stats.h"
 #include <linux/mm.h>
+#include <linux/buffer_head.h>
 #ifdef HAVE_MM_INLINE_H
 #include <linux/mm_inline.h>
 #endif
@@ -3292,6 +3293,7 @@ static struct address_space_operations afs_file_aops = {
   .readpage =          afs_linux_readpage,
   .readpages =                 afs_linux_readpages,
   .writepage =         afs_linux_writepage,
+  .set_page_dirty =    __set_page_dirty_buffers,
 #if defined (STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN)
   .write_begin =        afs_linux_write_begin,
   .write_end =          afs_linux_write_end,