diff mbox

[1/3] UBIFS: assert no fixup when writing a node

Message ID 4a63933a3365daf8d1ec38d22c9029a949f3eccd.1306780983.git.bengardiner@nanometrics.ca
State New, archived
Headers show

Commit Message

Ben Gardiner May 30, 2011, 6:56 p.m. UTC
The current free space fixup can result in some writing to the UBI volume
when the space_fixup flag is set.

To catch instances where UBIFS is writing to the NAND while the space_fixup
flag is set, add an assert to ubifs_write_node().

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>

---
 fs/ubifs/io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Artem Bityutskiy June 1, 2011, 10:03 a.m. UTC | #1
On Mon, 2011-05-30 at 14:56 -0400, Ben Gardiner wrote:
> The current free space fixup can result in some writing to the UBI volume
> when the space_fixup flag is set.
> 
> To catch instances where UBIFS is writing to the NAND while the space_fixup
> flag is set, add an assert to ubifs_write_node().
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> 
> ---
>  fs/ubifs/io.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
> index 166951e..db298de 100644
> --- a/fs/ubifs/io.c
> +++ b/fs/ubifs/io.c
> @@ -763,6 +763,8 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
>  	if (c->ro_error)
>  		return -EROFS;
>  
> +	ubifs_assert(!c->space_fixup);
> +

I've moved this assert upper to where all other assertions are placed.

I've also added this assertion to 'ubifs_wbuf_write_nolock()' because it
is the other often used write path.

And pushed to the UBIFS tree, thanks.
diff mbox

Patch

diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 166951e..db298de 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -763,6 +763,8 @@  int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
 	if (c->ro_error)
 		return -EROFS;
 
+	ubifs_assert(!c->space_fixup);
+
 	ubifs_prepare_node(c, buf, len, 1);
 	err = ubi_leb_write(c->ubi, lnum, buf, offs, buf_len, dtype);
 	if (err) {