[PATCH v2] ubifs: remove unnecessary check in ubifs_log_start_commit

2018-08-23 Thread Liu Song
the value of c->lhead_offs is far less than c->leb_size. The check 'if (c->lhead_offs == c->leb_size)' could never to be true. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- v2: Improve description and code as suggestted by Richard. fs/ubifs/log.c | 5 + 1

[PATCH] ubifs: remove unnecessary check in ubifs_log_start_commit

2018-08-20 Thread Liu Song
The value of c->lhead_offs cannot exceed max_len which much smaller than c->leb_size. So the check will never be true. Just remove it. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- fs/ubifs/log.c | 4 1 file changed, 4 deletions(-) diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c

[PATCH v2] mtd/ubi: Make sure to read volume record from LEB 0 or LEB 1

2018-08-20 Thread Liu Song
Even though we protect on-flash data by CRC checksums, we still don't trust the media. If lnum is not 0 or 1, access exceed array boundary can lead to bad situation. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- v2: fix the name in *From*. drivers/mtd/ubi/vtbl.c | 4 1 file ch

[PATCH] mtd/ubi: Make sure to read volume record from LEB 0 or LEB 1

2018-08-19 Thread Liu Song
From: fishland Even though we protect on-flash data by CRC checksums, we still don't trust the media. If lnum is not 0 or 1, access exceed array boundary can lead to bad situation. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- drivers/mtd/ubi/vtbl.c | 4 1 file chang

[PATCH] UBIFS: Fix typo of output in get_cs_sqnum

2018-08-19 Thread Liu Song
"Not a CS node" makes more sense than "Node a CS node". Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- fs/ubifs/recovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 3af4472061cc..400163dc7022 1

[PATCH] Simplify redundant code

2018-08-05 Thread Liu Song
cbuf's size can be simply assigned. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- fs/ubifs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index c5466c7..1a8e2032 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/su

[PATCH] fs/jffs2 : prevent gc to pick block which includes inode with I_NEW state

2018-07-31 Thread Liu Song
After testing, it can effectively solve the deadlock bug. Reported-by: Yang Yi Signed-off-by: Liu Song Tested-by: Yang Yi Reviewed-by: Jiang Biao --- fs/jffs2/build.c | 1 + fs/jffs2/dir.c | 22 +- fs/jffs2/gc.c | 4 fs/jffs2/jffs2_fs_sb.h | 1 +

[PATCH] Improve code readability

2018-07-30 Thread Liu Song
Merge the duplicated complex conditions to improve code readability. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- fs/ext4/inode.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7d6c100..c2bc1fd 100644 --- a/fs

[PATCH] fs/UBIFS: make 'sum' definition closer to where it is used

2018-02-27 Thread Liu Song
Local var sum is only used in one branch, and it may be not used if it is defined outside the branch. Try to move the definition into the branch to make it closer to where it is actually used. Signed-off-by: Liu Song Reviewed-by: Jiang Biao --- fs/ubifs/find.c | 3 ++- 1 file changed, 2

[PATCH] jffs2: fix potential deadlock in jffs2_do_setattr

2017-10-11 Thread Liu Song
In jffs2_do_setattr, we hold two mutexes which are A) c->alloc_sem B) f->sem If new_metadata is error, then we release mutexes in bad sequence which could cause ABAB deadlock. This patch adjusts release sequence which could avoid deadlock. Signed-off-by: Liu Song Reviewed-by: Jian