Re: generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Chris Mason



On Friday, January 12, 2001 04:30:44 PM -0500 Alexander Viro
<[EMAIL PROTECTED]> wrote:

> 
> 
> On Fri, 12 Jan 2001, Chris Mason wrote:
> 
>> 
>> Hi guys,
>> 
>> This code for generic_file_write calls vmtruncate without i_sem held.  Is
>> that intentional?  It should cause problems for reiserfs at least...
> 
> Erm... generic_file_write() grabs i_sem upon entry and drops it on exit.
> This call of vmtruncate() is deep inside the protected area.
> 

Yup, I'm trying to track down a different problem, and saw what I wanted to
instead of what was really there.  Sigh.  

-chris

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Alexander Viro



On Fri, 12 Jan 2001, Chris Mason wrote:

> 
> Hi guys,
> 
> This code for generic_file_write calls vmtruncate without i_sem held.  Is
> that intentional?  It should cause problems for reiserfs at least...

Erm... generic_file_write() grabs i_sem upon entry and drops it on exit.
This call of vmtruncate() is deep inside the protected area.

It is taken out of the main path for obvious reasons, but as far as
control flow counts it sits inside the main loop. FWIW, it might
as well be written as

status = mapping->a_ops->prepare_write(.);
if (status) {
UnlockPage(page);
deactivate_page(page);
page_cache_release(page);
if (pos + bytes > inode->i_size)
vmtruncate(inode, inode->i_size);
break;
}
...
except that this variant would litter the main path. And the whole loop
is under the ->i_sem - check the beginning of the function.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Chris Mason


Hi guys,

This code for generic_file_write calls vmtruncate without i_sem held.  Is
that intentional?  It should cause problems for reiserfs at least...

-chris

diff -u --new-file --recursive --exclude-from /usr/src/exclude
linux-2.4.0/mm/filemap.c linux.ac/mm/filemap.c
--- linux-2.4.0/mm/filemap.cWed Jan  3 02:59:45 2001
+++ linux.ac/mm/filemap.c   Thu Jan 11 17:26:55 2001
@@ -2578,6 +2625,13 @@
ClearPageUptodate(page);
kunmap(page);
goto unlock;
+sync_failure:
+   UnlockPage(page);
+   deactivate_page(page);
+   page_cache_release(page);
+   if (pos + bytes > inode->i_size)
+   vmtruncate(inode, inode->i_size);
+   goto done;
 }

 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Chris Mason


Hi guys,

This code for generic_file_write calls vmtruncate without i_sem held.  Is
that intentional?  It should cause problems for reiserfs at least...

-chris

diff -u --new-file --recursive --exclude-from /usr/src/exclude
linux-2.4.0/mm/filemap.c linux.ac/mm/filemap.c
--- linux-2.4.0/mm/filemap.cWed Jan  3 02:59:45 2001
+++ linux.ac/mm/filemap.c   Thu Jan 11 17:26:55 2001
@@ -2578,6 +2625,13 @@
ClearPageUptodate(page);
kunmap(page);
goto unlock;
+sync_failure:
+   UnlockPage(page);
+   deactivate_page(page);
+   page_cache_release(page);
+   if (pos + bytes  inode-i_size)
+   vmtruncate(inode, inode-i_size);
+   goto done;
 }

 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Alexander Viro



On Fri, 12 Jan 2001, Chris Mason wrote:

 
 Hi guys,
 
 This code for generic_file_write calls vmtruncate without i_sem held.  Is
 that intentional?  It should cause problems for reiserfs at least...

Erm... generic_file_write() grabs i_sem upon entry and drops it on exit.
This call of vmtruncate() is deep inside the protected area.

It is taken out of the main path for obvious reasons, but as far as
control flow counts it sits inside the main loop. FWIW, it might
as well be written as

status = mapping-a_ops-prepare_write(.);
if (status) {
UnlockPage(page);
deactivate_page(page);
page_cache_release(page);
if (pos + bytes  inode-i_size)
vmtruncate(inode, inode-i_size);
break;
}
...
except that this variant would litter the main path. And the whole loop
is under the -i_sem - check the beginning of the function.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: generic_file_write change in 2.4.0-ac8

2001-01-12 Thread Chris Mason



On Friday, January 12, 2001 04:30:44 PM -0500 Alexander Viro
[EMAIL PROTECTED] wrote:

 
 
 On Fri, 12 Jan 2001, Chris Mason wrote:
 
 
 Hi guys,
 
 This code for generic_file_write calls vmtruncate without i_sem held.  Is
 that intentional?  It should cause problems for reiserfs at least...
 
 Erm... generic_file_write() grabs i_sem upon entry and drops it on exit.
 This call of vmtruncate() is deep inside the protected area.
 

Yup, I'm trying to track down a different problem, and saw what I wanted to
instead of what was really there.  Sigh.  

-chris

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/