If PAGE_SIZE is unsigned type then negative error code will be
larger than PAGE_SIZE.
Signed-off-by: Chengguang Xu
---
kernel/power/swap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index c2bcf97d24c8..d7f6c1a288d3 100644
When we try to truncate read count in generic_file_buffered_read(),
should deliver (sb->s_maxbytes - offset) as maximum count not
sb->s_maxbytes itself.
Signed-off-by: Chengguang Xu
---
mm/filemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/filemap.c b/mm/fil
Hi Yuanliang,
Can you explain how to reproduce it? and what filesystem do you use as
underlying fs?
> Sent: Tuesday, March 20, 2018 at 2:03 PM
> From: 王元良
> To: mik...@szeredi.hu
> Cc: linux-unio...@vger.kernel.org, linux-kernel@vger.kernel.org, 王元良
>
> Subject: [PATCH] fs/overlayfs: Drop de
Hi Yuanliang,
Can you try ext4 or xfs(with ftype=1) as underlying fs?
It seems the phenomenon that I met on xfs(with ftype=0) as underlying fs.
Thanks,
Chengguang.
> Sent: Tuesday, March 20, 2018 at 2:44 PM
> From: "Chengguang Xu"
> To: 王元良
> Cc: mik...@
first and
check if the problem still persist.
The phenomenon I met is similar to yours in the previous email.
Thanks,
Chengguang.
-
Sent: Tuesday, March 20, 2018 at 3:22 PM
From: 王元良
To: "Chengguang Xu" , "Chengguang Xu"
Cc: miklos , linux-unionfs ,
linux-kernel
Check memory allocation result for cachetag in mount option
parsing and fix potential memory leak in the error case.
Signed-off-by: Chengguang Xu
---
fs/9p/v9fs.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 8fb89dd..e622f0f 100644
--- a/fs/9p
The flag 'SLAB_PANIC' implies panic when encouter failure,
so there is no need to check NULL pointer and return error
code.
Signed-off-by: Chengguang Xu
---
arch/x86/mm/pgtable.c | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/x86/mm/pgtable.c b/a
The flag 'SLAB_PANIC' implies panic when encouter failure,
So there is no need to check NULL pointer for cache creation.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Keep return type as int instead of changing to void.
arch/x86/mm/pgtable.c | 3 ---
1 file changed, 3 deletions(-)
Signed-off-by: Chengguang Xu
---
fs/exofs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index f3e17a9..75b5db0 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -118,7 +118,7 @@ static int parse_options(char *options, struct
There are some cases can cause memory leak when parsing
option 'osdname'.
Signed-off-by: Chengguang Xu
---
fs/exofs/super.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 719a315..f3e17a9 100644
--- a/fs/exofs/super.
code analyzing tool(like Smatch) and also make the code more
easy to understand.
Suggested-by: Dan Carpenter
Signed-off-by: Chengguang Xu
---
fs/char_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/char_dev.c b/fs/char_dev.c
index d18cad28c1c3..00dfe17871ac 100644
在 星期一, 2020-12-07 19:24:10 Dominique Martinet 撰写
> Chengguang Xu wrote on Mon, Dec 07, 2020:
> > > , VM_MAYWRITE is set anytime we have a shared map where file has
> > > been opened read-write, which seems to be what you want with regards to
> > >
If vma is shared and the file was opened for writing,
we should also create writeback fid because vma may be
mprotected writable even if now readonly.
Signed-off-by: Chengguang Xu
---
fs/9p/vfs_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/9p/vfs_file.c b/fs/9p
If vma is shared and the file was opened for writing,
we should also create writeback fid because vma may be
mprotected writable even if now readonly.
Signed-off-by: Chengguang Xu
---
Caveat: Only compile tested.
fs/9p/vfs_file.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff
在 星期一, 2020-12-07 04:53:18 Dominique Martinet 撰写
> Dominique Martinet wrote on Sun, Dec 06, 2020:
> > Chengguang Xu wrote on Sat, Dec 05, 2020:
> > > If vma is shared and the file was opened for writing,
> > > we should also create write
Actually, total amount of available minor number
for a single major is MINORMARK + 1. So expand
minor range when registering chrdev region.
Signed-off-by: Chengguang Xu
---
drivers/misc/mei/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/mei/main.c b
Current overlap check of minor range cannot correctly
handle a case which is baseminor < existing baseminor &&
baseminor + minorct > existing baseminor + minorct.
Fix it and meanwhile do some code cleanups.
Fixes: 01d553d0fe9f90 ("Chardev checking of overlapping ranges")
S
Currently chardev allows to share major, showing
major with minor range for chardev will be more
helpful.
Signed-off-by: Chengguang Xu
---
fs/char_dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/char_dev.c b/fs/char_dev.c
index b25b1da097d5..6f00acdeb308 100644
Replace (flags & DQUOT_SPACE_RESERVE) with
variable reserve.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba..00de508f9d2e 100644
--- a/fs/quota/dquot.c
+++
Check quota type in early stage so we can avoid many
unncessary operations when the type is wrong.
Signed-off-by: Chengguang Xu
---
fs/quota/quota.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index cb13fb76dbee..5444d3c4d93f
Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL
on error case before jump to do dqput().
Signed-off-by: Chengguang Xu
---
fs/ocfs2/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 2e982db3e1ae..53939bf9d7d2 100644
--- a/fs/ocfs2/file.c
+++ b
It is meaningless to increase DQST_LOOKUPS number while iterating
over dirty/inuse list, so just avoid it.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6e826b454082..00a3c6df2ea3 100644
--- a/fs
Code cleanup for hash bits calculation by
calling rounddown_pow_of_two() and ilog2()
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6e826b454082..679dd3b5db70 100644
--- a/fs
Code cleanup for hash bits calculation by
calling ilog2().
Signed-off-by: Chengguang Xu
---
v1->v2:
- Calculate hash bits by directly calling ilog2().
fs/quota/dquot.c | 6 +-
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
in
ff-by: Chengguang Xu
---
fs/9p/vfs_file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 4cc966a31cb3..fe7f0bd2048e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -513,6 +513,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct
vm_area_s
It's not a functinal change, it's just for keeping
consistent coding style.
Signed-off-by: Chengguang Xu
---
fs/quota/quota_v1.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index c740e5572eb8..cd92e5fa0062 100644
--- a/fs/quota/quota_
In order to avoid using incorrect mnt, we should set
mnt to NULL when we get error from mount_one_hugetlbfs().
Signed-off-by: Chengguang Xu
---
fs/hugetlbfs/inode.c | 9 ++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index
Current overlap checking cannot correctly handle
a case which is baseminor < existing baseminor &&
baseminor + minorct > existing baseminor + minorct.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
The function comment of __register_chrdev_region()
is out of date, so update it based on the code.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
fs/char_dev.c | 9 +++--
1 file changed, 3 insertions(+), 6 deleti
register_chrdev_region() carefully checks minor range
before calling __register_chrdev_region() but there is
another path from alloc_chrdev_region() which does not
check the range properly. So add a check for given minor
range in __register_chrdev_region().
Signed-off-by: Chengguang Xu
---
v1
It's just code cleanup, not functional change.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
fs/char_dev.c | 69 +--
1 file changed, 28 insertions(+), 41 d
Should jump to lable err_infoopen when idev->info is NULL
in uio_open().
Signed-off-by: Chengguang Xu
---
drivers/uio/uio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 131342280b46..46e5c1c31ebe 100644
--- a/drivers/uio/ui
It is not necessary to check idev->info several times under
mutex lock, so just remove redundant check.
Signed-off-by: Chengguang Xu
---
drivers/uio/uio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 46e5c1c31
Remove unnecessary ERR_PTR()/PTR_ERR() cast in
proc_setup_thread_self().
Signed-off-by: Chengguang Xu
---
fs/proc/thread_self.c | 16
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index b905010ca9eb..f61ae53533f5
Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_self().
Signed-off-by: Chengguang Xu
---
fs/proc/self.c | 16
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 127265e5c55f..57c0a1047250 100644
--- a/fs/proc/self.c
When fail from creating cache jbd2_inode_cache, we will
destroy previously created cache jbd2_handle_cache twice.
This patch fixes it by sperating each cache
initialization/destruction to individual function.
Signed-off-by: Chengguang Xu
---
v2:
- Seperate cache initialization/destruction to
Convert mount option checking code to test_opt() in
qnx6_show_options().
Signed-off-by: Chengguang Xu
---
fs/qnx6/inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 59cf45f6be49..c3a80700e7a6 100644
--- a/fs/qnx6/inode.c
+++ b
Current overlap checking cannot correctly handle
a case which is baseminor < existing baseminor &&
baseminor + minorct > existing baseminor + minorct.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
register_chrdev_region() carefully checks minor range
before calling __register_chrdev_region() but there is
another path from alloc_chrdev_region() which does not
check the range properly. So add a check for given minor
range in __register_chrdev_region().
Signed-off-by: Chengguang Xu
---
v1
The function comment of __register_chrdev_region()
is out of date, so update it based on the code.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
fs/char_dev.c | 9 +++--
1 file changed, 3 insertions(+), 6 deleti
It's just code cleanup, not functional change.
Signed-off-by: Chengguang Xu
---
v1->v2:
- Split fix and cleanup patches.
- Remove printing minor range in chrdev_show().
v2->v3:
- Set variable ret to '-EBUSY' before checking minor range overlap.
> Sent: Friday, April 05, 2019 at 8:32 PM
> From: "Greg KH"
> To: "Chengguang Xu"
> Cc: dan.carpen...@oracle.com, linux-fsde...@vger.kernel.org,
> v...@zeniv.linux.org.uk, linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 3/4] chardev: code cleanup fo
code analyzing tool(like Smatch) and also make the code more
easy to understand.
Suggested-by: Dan Carpenter
Signed-off-by: Chengguang Xu
---
fs/char_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/char_dev.c b/fs/char_dev.c
index df6a54045ac4..00dfe17871ac 100644
We need to check return code only when calling ->read_dqblk(),
so fix it properly.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba..934b8f3f9e57 100644
--- a
jbd2_journal_destroy_caches() can handle destruction work
for all caches, so we don't have to destroy previously
created cache in error path, it also makes the code simpler.
Signed-off-by: Chengguang Xu
---
fs/jbd2/revoke.c | 9 +++--
1 file changed, 3 insertions(+), 6 deletions(-)
jbd2_journal_init_journal_head_cache() only be called once,
so add __init annotation for it and do some code cleanup.
Signed-off-by: Chengguang Xu
---
fs/jbd2/journal.c | 9 +++--
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index
When fail from creating cache jbd2_inode_cache, we will
destroy previously created cache jbd2_handle_cache twice.
This patch fixes it by removing first destroy in error path.
Signed-off-by: Chengguang Xu
---
fs/jbd2/journal.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/jbd2/journal.c
Some function comments about projid are described
as uid, so fix it.
Signed-off-by: Chengguang Xu
---
kernel/user_namespace.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 923414a246e9..6e917fc072d0 100644
Actually there are four lists for dquot management, so add
the description of dqui_dirty_list to comment.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 10 +++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba
Set init_needed flag only when successfully getting dquot,
so that we can skip unnecessary subsequent operation.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba
When we fail from allocating inode/space, we back out
the change we already did. In a special case which has
exceeded soft limit by the change, we should also check
time limit and reset it properly.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 14 ++
1 file changed, 6
code analyzing tool(like Smatch) and also make the code more
easy to understand.
Suggested-by: Dan Carpenter
Signed-off-by: Chengguang Xu
---
v1->v2:
- Rebase against the latest char-misc-next.
- Modify signed-off mail address.
fs/char_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 delet
We reset time limit when current usage is smaller
or equal to soft limit in other place, so follow
this rule in do_set_dqblk().
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index
When specifying option 'prefix' multiple times,
current option parsing will cause memory leak.
Hence, call kfree for previous one in this case.
Signed-off-by: Chengguang Xu
---
fs/affs/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/affs/super.c b/fs/affs/super.c
ind
trans' and 'version'
when detecting -EINVAL.
Signed-off-by: Chengguang Xu
---
Changes since v2:
- Introduce a new temporary variable to avoid overriding error code.
Changes since v1:
- Do not change behavior when detecting ENOMEM or unrecognized options.
net/9p/client.c | 13 +
cache' and 'access'
when detecting -EINVAL.
Signed-off-by: Chengguang Xu
---
Changes since v2:
- Introduce a new temporary variable to avoid overriding error code.
- Delete redundant continue in error case.
Changes since v1:
- Do not change behavior when detecting ENOMEM or unrecogniz
When specifying string type mount option (e.g., iocharset)
several times in a mount, current option parsing may
cause memory leak. Hence, call kfree for previous one
in this case. Meanwhile, check memory allocation result
for it.
Signed-off-by: Chengguang Xu
---
fs/isofs/inode.c | 3 +++
1 file
When specifying string type mount option several times
in a mount, current option parsing may cause memory leak.
Hence, call kfree for previous one in this case.
Signed-off-by: Chengguang Xu
---
fs/exofs/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/exofs/super.c b/fs/exofs
case of memory
allocation error in option parsing.
Signed-off-by: Chengguang Xu
---
fs/9p/v9fs.c | 49 -
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index e622f0f..29ba937 100644
--- a/fs/9p/v9fs.c
case of memory
allocation error in option parsing.
Signed-off-by: Chengguang Xu
---
net/9p/client.c | 18 +++---
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/net/9p/client.c b/net/9p/client.c
index 21e6df1..066f136 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
cache' and 'access'
when detecting EINVAL.
Signed-off-by: Chengguang Xu
---
Changes since v1:
- Do not change behavior when detecting ENOMEM or unrecognized options.
fs/9p/v9fs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
in
trans' and 'version'
when detecting EINVAL.
Signed-off-by: Chengguang Xu
---
Changes since v1:
- Do not change behavior when detecting ENOMEM or unrecognized options.
net/9p/client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/9p/client.c b/net/9p/cl
When specifying iocharset/codepage multiple times in a mount,
current option parsing will cause inaccurate refcount of nls
module. Hence, call unload_nls for previous one in this case.
Signed-off-by: Chengguang Xu
---
fs/hfs/super.c | 8 ++--
1 file changed, 6 insertions(+), 2 deletions
When specifying nls option multiple times in a mount,
current option parsing will cause inaccurate refcount of nls
module. Hence, call unload_nls for previous one in this case.
Signed-off-by: Chengguang Xu
---
fs/hfsplus/options.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff
The assignment of variable ret is redundant because the
value of ret is 0 after calling v2_read_header() in normal
case.
Signed-off-by: Chengguang Xu
---
fs/quota/quota_v2.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index a73e5b34db41
Count the number of quotas which are needed to initialize,
instead of just setting to 1 so that we may avoid unnecessary
process in special case.
Signed-off-by: Chengguang Xu
---
fs/quota/dquot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/quota/dquot.c b/fs/quota
When specifiying iocharset multiple times in a mount
or once/multiple in a remount, current option parsing
may cause inaccurate refcount of nls module.
Also, in the failure cleanup of option parsing,
the condition of calling unload_nls is not sufficient.
Signed-off-by: Chengguang Xu
---
Hi Jan
Commit-ID: 765d28f136291f9639e3c031a1070fb76d6625c7
Gitweb: https://git.kernel.org/tip/765d28f136291f9639e3c031a1070fb76d6625c7
Author: Chengguang Xu
AuthorDate: Tue, 12 Jun 2018 19:48:52 +0800
Committer: Thomas Gleixner
CommitDate: Thu, 2 Aug 2018 14:27:35 +0200
x86/mm: Remove
68 matches
Mail list logo