Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xfs: don't update mtime on COW faults

When running in a dax mode, if the user maps a page with MAP_PRIVATE and
PROT_WRITE, the xfs filesystem would incorrectly update ctime and mtime
when the user hits a COW fault.

This breaks building of the Linux kernel. How to reproduce:

1. extract the Linux kernel tree on dax-mounted xfs filesystem
2. run make clean
3. run make -j12
4. run make -j12

at step 4, make would incorrectly rebuild the whole kernel (although it
was already built in step 3).

The reason for the breakage is that almost all object files depend on
objtool. When we run objtool, it takes COW page fault on its .data
section, and these faults will incorrectly update the timestamp of the
objtool binary. The updated timestamp causes make to rebuild the whole
tree.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mikulas Patocka and committed by
Linus Torvalds
b17164e2 1ef6ea0e

+10 -2
+10 -2
fs/xfs/xfs_file.c
··· 1223 1223 return ret; 1224 1224 } 1225 1225 1226 + static inline bool 1227 + xfs_is_write_fault( 1228 + struct vm_fault *vmf) 1229 + { 1230 + return (vmf->flags & FAULT_FLAG_WRITE) && 1231 + (vmf->vma->vm_flags & VM_SHARED); 1232 + } 1233 + 1226 1234 static vm_fault_t 1227 1235 xfs_filemap_fault( 1228 1236 struct vm_fault *vmf) ··· 1238 1230 /* DAX can shortcut the normal fault path on write faults! */ 1239 1231 return __xfs_filemap_fault(vmf, PE_SIZE_PTE, 1240 1232 IS_DAX(file_inode(vmf->vma->vm_file)) && 1241 - (vmf->flags & FAULT_FLAG_WRITE)); 1233 + xfs_is_write_fault(vmf)); 1242 1234 } 1243 1235 1244 1236 static vm_fault_t ··· 1251 1243 1252 1244 /* DAX can shortcut the normal fault path on write faults! */ 1253 1245 return __xfs_filemap_fault(vmf, pe_size, 1254 - (vmf->flags & FAULT_FLAG_WRITE)); 1246 + xfs_is_write_fault(vmf)); 1255 1247 } 1256 1248 1257 1249 static vm_fault_t