ext2: Use page_mkwrite vma_operations to get mmap write notification.
Subsystems (2)
PATCH 1/1 ext2: Use page_mkwrite vma_operations to get mmap write notification.
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
--- fs/ext2/ext2.h | 1 + fs/ext2/file.c | 21 ++++++++++++++++++++- fs/ext2/inode.c | 5 +++++ 3 files changed, 26 insertions(+), 1 deletions(-)
fs/ext2/ext2.h +1 -0
@@ -136,6 +136,7 @@ extern void ext2_get_inode_flags(struct ext2_inode_info *);int __ext2_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata); +extern int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page);/* ioctl.c */ extern long ext2_ioctl (struct file *,unsigned int ,unsigned long );
fs/ext2/file.c +20 -1
@@ -18,6 +18,7 @@* ([email protected]) */ +#include <linux/mm.h> #include <linux/time.h> #include "ext2.h" #include "xattr.h"
@@ -38,6 +39,24 @@ static int ext2_release_file (struct inode * inode, struct file * filp)return 0 ; } +static struct vm_operations_struct ext2_file_vm_ops = { + .fault = filemap_fault, + .page_mkwrite = ext2_page_mkwrite, +}; + +static int ext2_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct address_space *mapping = file->f_mapping; + +if (!mapping->a_ops->readpage) +return -ENOEXEC ; +file_accessed (file); + vma->vm_ops = &ext2_file_vm_ops; + vma->vm_flags |=VM_CAN_NONLINEAR ; +return 0 ; +} + +/* * We have mostly NULL's here: the current defaults are ok for * the ext2 filesystem.
@@ -52,7 +71,7 @@ static int ext2_release_file (struct inode * inode, struct file * filp)#ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ext2_file_mmap, .open = generic_file_open, .release = ext2_release_file, .fsync = ext2_sync_file,
fs/ext2/inode.c +5 -0
@@ -1443,3 +1443,8 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) error =ext2_acl_chmod (inode);return error; } + +int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page) +{ +return block_page_mkwrite (vma, page, ext2_get_block); +}
Signature · 1 line
1.5.5.1.357.g1af8b.dirty
PATCH 1/1 ext3: Use page_mkwrite vma_operations to get mmap write notification.
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
--- fs/ext3/file.c | 19 +++++++++++- fs/ext3/inode.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/ext3_fs.h | 1 + 3 files changed, 95 insertions(+), 1 deletions(-)
fs/ext3/file.c +18 -1
@@ -106,6 +106,23 @@ ext3_file_write(struct kiocb *iocb, const struct iovec *iov,return ret; } +static struct vm_operations_struct ext3_file_vm_ops = { + .fault = filemap_fault, + .page_mkwrite = ext3_page_mkwrite, +}; + +static int ext3_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct address_space *mapping = file->f_mapping; + +if (!mapping->a_ops->readpage) +return -ENOEXEC ; +file_accessed (file); + vma->vm_ops = &ext3_file_vm_ops; + vma->vm_flags |=VM_CAN_NONLINEAR ; +return 0 ; +} +const struct file_operations ext3_file_operations = { .llseek = generic_file_llseek, .read = do_sync_read,
@@ -116,7 +133,7 @@ ext3_file_write(struct kiocb *iocb, const struct iovec *iov,#ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ext3_file_mmap, .open = generic_file_open, .release = ext3_release_file, .fsync = ext3_sync_file,
fs/ext3/inode.c +76 -0
79 lines not on this page · raw message
include/linux/ext3_fs.h +1 -0
@@ -836,6 +836,7 @@ extern void ext3_truncate (struct inode *);extern void ext3_set_inode_flags (struct inode *);extern void ext3_get_inode_flags (struct ext3_inode_info *);extern void ext3_set_aops (struct inode *inode); +extern int ext3_page_mkwrite (struct vm_area_struct *vma,struct page *page);/* ioctl.c */ extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
Signature · 1 line
1.5.5.1.357.g1af8b.dirty
Andrew Morton
maintainerQuoted 4 lines · On Thu, 5 Jun 2008 22:35:12 +0530 "Aneesh Kumar K.V"…
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
Whoa. You didn't copy anything like enough mailing lists for a change of this magnitude. I added some.
This is a large change in behaviour!
a) applications will now get a synchronous SIGBUS when modifying a page over an ENOSPC filesystem. Whereas previously they could have proceeded to completion and then detected the error via an fsync().
It's going to take more than one skimpy little paragraph to justify this, and to demonstrate that it is preferable, and to convince us that nothing will break from this user-visible behaviour change.
b) we're now doing fs operations (and some I/O) in the pagefault code. This has several implications:
- performance changes
- potential for deadlocks when a process takes the fault from within a copy_to_user() in, say, mm/filemap.c
- performing additional memory allocations within that copy_to_user(). Possibility that these will reenter the filesystem.
And that's just ext2.
For ext3 things are even more complex, because we have the journal_start/journal_end pair which is effectively another "lock" for ranking/deadlock purposes. And now we're taking i_alloc_sem and lock_page and we're doing ->writepage() and its potential journal_start(), all potentially within the context of a copy_to_user().
Now, things become easier because copy_to_user() only happens on the read() side of things, where we don't hold lock_page() and things are generally simpler.
But still, this is a high-risk change. I think we should require a lot of convincing that issues such as the above have been suitably considered and addressed, and that the change has had *intense* testing.
Quoted 28 lines
index 47d88da..cc2e106 100644
fs/ext2/ext2.h +1
-0@@ -136,6 +136,7 @@ extern void ext2_get_inode_flags(struct ext2_inode_info *);int __ext2_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata); +extern int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page);/* ioctl.c */ extern long ext2_ioctl (struct file *,unsigned int ,unsigned long );fs/ext2/file.c +2
-0@@ -18,6 +18,7 @@* ([email protected]) */ +#include <linux/mm.h> #include <linux/time.h> #include "ext2.h" #include "xattr.h" @@ -38,6 +39,24 @@ static int ext2_release_file (struct inode * inode, struct file * filp)return 0 ; } +static struct vm_operations_struct ext2_file_vm_ops = {
fs/ext2/file.c static int ext2_release_file (struct inode * inode, struct file * filp) · line 52
Quoted 10 lines
fs/ext2/file.c +10
-0+ .fault = filemap_fault, + .page_mkwrite = ext2_page_mkwrite, +}; + +static int ext2_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct address_space *mapping = file->f_mapping; + +if (!mapping->a_ops->readpage) +return -ENOEXEC ;
this copied-and-pasted test can now be removed.
Quoted 34 lines
fs/ext2/file.c +8
-1+file_accessed (file); + vma->vm_ops = &ext2_file_vm_ops; + vma->vm_flags |=VM_CAN_NONLINEAR ; +return 0 ; +} + +/* * We have mostly NULL's here: the current defaults are ok for * the ext2 filesystem. @@ -52,7 +71,7 @@ static int ext2_release_file (struct inode * inode, struct file * filp)#ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ext2_file_mmap, .open = generic_file_open, .release = ext2_release_file, .fsync = ext2_sync_file,fs/ext2/inode.c +5
-0@@ -1443,3 +1443,8 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) error =ext2_acl_chmod (inode);return error; } + +int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page) +{ +return block_page_mkwrite (vma, page, ext2_get_block); +}Signature · 1 line
1.5.5.1.357.g1af8b.dirty
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Thu, 5 Jun 2008 22:35:12 +0530 "Aneesh Kumar K.V"…
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
Quoted 8 lines
Whoa. You didn't copy anything like enough mailing lists for a change of this magnitude. I added some.
This is a large change in behaviour!
a) applications will now get a synchronous SIGBUS when modifying a page over an ENOSPC filesystem. Whereas previously they could have proceeded to completion and then detected the error via an
fsync().
Or not detect the error at all if we don't call fsync() right ? Isn't a synchronous SIGBUS the right behaviour ?
Quoted 18 lines
It's going to take more than one skimpy little paragraph to justify this, and to demonstrate that it is preferable, and to convince us that nothing will break from this user-visible behaviour change.
b) we're now doing fs operations (and some I/O) in the pagefault code. This has several implications:
- performance changes
- potential for deadlocks when a process takes the fault from within a
copy_to_user()in, say,mm/filemap.c- performing additional memory allocations within that
copy_to_user(). Possibility that these will reenter the filesystem.
Quoted 8 lines
And that's just ext2.
For ext3 things are even more complex, because we have the journal_start/journal_end pair which is effectively another "lock" for ranking/deadlock purposes. And now we're taking
i_alloc_semandlock_pageand we're doing ->writepage() and its potentialjournal_start(), all potentially within the context of acopy_to_user().
One of the reason why we would need this in ext3/ext4 is that we cannot do block allocation in the writepage with the recent locking changes. The locking changes involve changing the locking order of journal_start and page_lock. With writepage we are already called with page_lock and we can't start new transaction needed for block allocation.
But if we agree that we should not do block allocation in page_mkwrite we need to add writepages and allocate blocks in writepages.
Quoted 76 lines
Now, things become easier because
copy_to_user()only happens on theread()side of things, where we don't holdlock_page()and things are generally simpler.But still, this is a high-risk change. I think we should require a lot of convincing that issues such as the above have been suitably considered and addressed, and that the change has had *intense* testing.
Quoted 28 lines
index 47d88da..cc2e106 100644
fs/ext2/ext2.h +1
-0@@ -136,6 +136,7 @@ extern void ext2_get_inode_flags(struct ext2_inode_info *);int __ext2_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata); +extern int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page);/* ioctl.c */ extern long ext2_ioctl (struct file *,unsigned int ,unsigned long );fs/ext2/file.c +2
-0@@ -18,6 +18,7 @@* ([email protected]) */ +#include <linux/mm.h> #include <linux/time.h> #include "ext2.h" #include "xattr.h" @@ -38,6 +39,24 @@ static int ext2_release_file (struct inode * inode, struct file * filp)return 0 ; } +static struct vm_operations_struct ext2_file_vm_ops = {fs/ext2/file.c static int ext2_release_file (struct inode * inode, struct file * filp) · line 52
Quoted 10 lines
fs/ext2/file.c +10
-0+ .fault = filemap_fault, + .page_mkwrite = ext2_page_mkwrite, +}; + +static int ext2_file_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct address_space *mapping = file->f_mapping; + +if (!mapping->a_ops->readpage) +return -ENOEXEC ;this copied-and-pasted test can now be removed.
Quoted 25 lines
fs/ext2/file.c +8
-1+file_accessed (file); + vma->vm_ops = &ext2_file_vm_ops; + vma->vm_flags |=VM_CAN_NONLINEAR ; +return 0 ; +} + +/* * We have mostly NULL's here: the current defaults are ok for * the ext2 filesystem. @@ -52,7 +71,7 @@ static int ext2_release_file (struct inode * inode, struct file * filp)#ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ext2_file_mmap, .open = generic_file_open, .release = ext2_release_file, .fsync = ext2_sync_file,fs/ext2/inode.c +0
-0@@ -1443,3 +1443,8 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) error =ext2_acl_chmod (inode);
Quoted 8 lines
fs/ext2/inode.c int ext2_setattr(struct dentry *dentry, struct iattr *iattr) · line 1450
Quoted 8 lines
fs/ext2/inode.c +5
-0return error; } + +int ext2_page_mkwrite (struct vm_area_struct *vma,struct page *page) +{ +return block_page_mkwrite (vma, page, ext2_get_block); +}
-aneesh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 12 lines · On Wed, 11 Jun 2008 20:38:45 +0530 "Aneesh Kumar K.V"…
Quoted 11 lines · Andrew Morton
Quoted 4 lines · On Thu, 5 Jun 2008 22:35:12 +0530 "Aneesh Kumar K.V"…
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
Whoa. You didn't copy anything like enough mailing lists for a change of this magnitude. I added some.
Quoted 9 lines
Quoted 5 lines
This is a large change in behaviour!
a) applications will now get a synchronous SIGBUS when modifying a page over an ENOSPC filesystem. Whereas previously they could have proceeded to completion and then detected the error via an
fsync().Or not detect the error at all if we don't call
fsync()right ? Isn't a synchronous SIGBUS the right behaviour ?
Not according to POSIX. Or at least posix-several-years-ago, when this last was discussed. The spec doesn't have much useful to say about any of this.
It's a significant change in the userspace interface.
Quoted 28 lines
Quoted 19 lines
It's going to take more than one skimpy little paragraph to justify this, and to demonstrate that it is preferable, and to convince us that nothing will break from this user-visible behaviour change.
b) we're now doing fs operations (and some I/O) in the pagefault code. This has several implications:
- performance changes
- potential for deadlocks when a process takes the fault from within a
copy_to_user()in, say,mm/filemap.c- performing additional memory allocations within that
copy_to_user(). Possibility that these will reenter the filesystem.Quoted 8 lines
And that's just ext2.
For ext3 things are even more complex, because we have the journal_start/journal_end pair which is effectively another "lock" for ranking/deadlock purposes. And now we're taking
i_alloc_semandlock_pageand we're doing ->writepage() and its potentialjournal_start(), all potentially within the context of acopy_to_user().
Quoted 2 lines
One of the reason why we would need this in ext3/ext4 is that we cannot do block allocation in the writepage with the recent locking changes.
Perhaps those recent locking changes were wrong.
Quoted 3 lines
The locking changes involve changing the locking order of
journal_startandpage_lock. With writepage we are already called withpage_lockand we can't start new transaction needed for block allocation.
ext3_write_begin() has journal_start() nesting inside the lock_page().
Quoted 2 lines
But if we agree that we should not do block allocation in
page_mkwritewe need to add writepages and allocate blocks in writepages.
I'm not sure what writepages has to do with pagefaults?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 62 lines · Andrew Morton
Quoted 12 lines · On Wed, 11 Jun 2008 20:38:45 +0530 "Aneesh Kumar K.V"…
Quoted 11 lines · Andrew Morton
Quoted 4 lines · On Thu, 5 Jun 2008 22:35:12 +0530 "Aneesh Kumar K.V"…
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
Whoa. You didn't copy anything like enough mailing lists for a change of this magnitude. I added some.
Quoted 9 lines
Quoted 5 lines
This is a large change in behaviour!
a) applications will now get a synchronous SIGBUS when modifying a page over an ENOSPC filesystem. Whereas previously they could have proceeded to completion and then detected the error via an
fsync().Or not detect the error at all if we don't call
fsync()right ? Isn't a synchronous SIGBUS the right behaviour ?Not according to POSIX. Or at least posix-several-years-ago, when this last was discussed. The spec doesn't have much useful to say about any of this.
It's a significant change in the userspace interface.
Quoted 28 lines
Quoted 19 lines
It's going to take more than one skimpy little paragraph to justify this, and to demonstrate that it is preferable, and to convince us that nothing will break from this user-visible behaviour change.
b) we're now doing fs operations (and some I/O) in the pagefault code. This has several implications:
- performance changes
- potential for deadlocks when a process takes the fault from within a
copy_to_user()in, say,mm/filemap.c- performing additional memory allocations within that
copy_to_user(). Possibility that these will reenter the filesystem.Quoted 8 lines
And that's just ext2.
For ext3 things are even more complex, because we have the journal_start/journal_end pair which is effectively another "lock" for ranking/deadlock purposes. And now we're taking
i_alloc_semandlock_pageand we're doing ->writepage() and its potentialjournal_start(), all potentially within the context of acopy_to_user().Quoted 2 lines
One of the reason why we would need this in ext3/ext4 is that we cannot do block allocation in the writepage with the recent locking changes.
Quoted 8 lines
Perhaps those recent locking changes were wrong.
Quoted 3 lines
The locking changes involve changing the locking order of
journal_startandpage_lock. With writepage we are already called withpage_lockand we can't start new transaction needed for block allocation.
ext3_write_begin()hasjournal_start()nesting inside thelock_page().
All those are changed as a part of lock inversion changes.
Quoted 5 lines
Quoted 2 lines
But if we agree that we should not do block allocation in
page_mkwritewe need to add writepages and allocate blocks in writepages.I'm not sure what writepages has to do with pagefaults?
The idea is to have ext3/4_writepages. In writepages start a transaction and iterate over the pages take the lock and do block allocation. With that change we should be able to not do block allocation in the page_mkwrite path. We may still want to do block reservation there.
Something like.
ext4_writepages()
{
journal_start()
for_each_page()
lock_page
if (bh_unmapped()...)
block_alloc()
unlock_page
journal_stop()}
ext4_writepage()
{
for_each_buffer_head()
if (bh_unmapped()) {
redirty_page
unlock_page
return;
}
}--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Aneesh Kumar K.V
Quoted 2 lines · Andrew Morton
On Wed, 11 Jun 2008 20:38:45 +0530
"Aneesh Kumar K.V" <[email protected]> wrote:The idea is to have ext3/4_writepages. In writepages start a transaction and iterate over the pages take the lock and do block allocation. With that change we should be able to not do block allocation in the
page_mkwritepath. We may still want to do block reservation there.
Quoted 6 lines
Something like.
ext4_writepages(){ journal_start() for_each_page()
Even with delayed allocation, the vast majority of the pages won't need any allocations. You'll hit delalloc, do a big chunk with the journal lock held and then do simple writepages that don't need anything special.
I know the jbd journal_start is cheaper than the reiserfs one is, but it might not perform well to hold it across the long writepages loop. At least reiser saw a good boost when I stopped calling journal_begin in writepage unless the page really needed allocations.
With the loop you have in mind, it is easy enough to back out and start the transaction only when required.
-chris
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 59 lines · Andrew Morton
Quoted 12 lines · On Wed, 11 Jun 2008 20:38:45 +0530 "Aneesh Kumar K.V"…
Quoted 11 lines · Andrew Morton
Quoted 4 lines · On Thu, 5 Jun 2008 22:35:12 +0530 "Aneesh Kumar K.V"…
We would like to get notified when we are doing a write on mmap section. The changes are needed to handle ENOSPC when writing to an mmap section of files with holes.
Whoa. You didn't copy anything like enough mailing lists for a change of this magnitude. I added some.
Quoted 9 lines
Quoted 5 lines
This is a large change in behaviour!
a) applications will now get a synchronous SIGBUS when modifying a page over an ENOSPC filesystem. Whereas previously they could have proceeded to completion and then detected the error via an
fsync().Or not detect the error at all if we don't call
fsync()right ? Isn't a synchronous SIGBUS the right behaviour ?Not according to POSIX. Or at least posix-several-years-ago, when this last was discussed. The spec doesn't have much useful to say about any of this.
It's a significant change in the userspace interface.
Quoted 28 lines
Quoted 27 lines
It's going to take more than one skimpy little paragraph to justify this, and to demonstrate that it is preferable, and to convince us that nothing will break from this user-visible behaviour change.
b) we're now doing fs operations (and some I/O) in the pagefault code. This has several implications:
- performance changes
- potential for deadlocks when a process takes the fault from within a
copy_to_user()in, say,mm/filemap.c- performing additional memory allocations within that
copy_to_user(). Possibility that these will reenter the filesystem.And that's just ext2.
For ext3 things are even more complex, because we have the journal_start/journal_end pair which is effectively another "lock" for ranking/deadlock purposes. And now we're taking
i_alloc_semandlock_pageand we're doing ->writepage() and its potentialjournal_start(), all potentially within the context of acopy_to_user().
Quoted 4 lines
Quoted 2 lines
One of the reason why we would need this in ext3/ext4 is that we cannot do block allocation in the writepage with the recent locking changes.
Perhaps those recent locking changes were wrong.
Well, the locking changes are those reverting locking ordering of
transaction start and page lock - we have them in ext4 and Aneesh seems to be looking into porting them to ext3 (at least ordered mode rewrite needs them). I wouldn't say they are wrong in principle.
It's easier to use page_mkwrite() to allocate blocks so that
later in writepage() we don't have to do block allocation which needs to start a transaction (because that means unlocking the page which gets quickly nasty to handle properly...).
BTW: XFS, OCFS2 or GFS2 define page_mkwrite() in this manner so they do
return SIGBUS when you run out of space when writing to mmapped hole. So it's not like this change is introducing completely new behavior... I can understand that we might not want to change the behavior for ext2 or ext3 but ext4 is IMO definitely free to choose.
Quoted 10 lines
Quoted 3 lines
The locking changes involve changing the locking order of
journal_startandpage_lock. With writepage we are already called withpage_lockand we can't start new transaction needed for block allocation.
ext3_write_begin()hasjournal_start()nesting inside thelock_page().Quoted 2 lines
But if we agree that we should not do block allocation in
page_mkwritewe need to add writepages and allocate blocks in writepages.I'm not sure what writepages has to do with pagefaults?
Honza
Signature · 8 lines
Jan Kara <[email protected]> SUSE Labs, CR -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Jan Kara
BTW: XFS, OCFS2 or GFS2 define
page_mkwrite()in this manner so they do
return SIGBUS when you run out of space when writing to mmapped hole. So it's not like this change is introducing completely new behavior... I can understand that we might not want to change the behavior for ext2 or ext3 but ext4 is IMO definitely free to choose.
Yup, and it's the only sane behaviour, IMO. Letting the application continue to oversubscribe filesystem space and then throwing away the data that can't be written well after the fact (potentially after the application has gone away) is a horrendously bad failure mode.
This was one of the main publicised features of ->page_mkwrite() - that it would allow up front detection of ENOSPC conditions during mmap writes. I'm extremely surprised to see that this is being considered undesirable after all this time....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]