Commit Graph

41 Commits

Author SHA1 Message Date
zgpeng 8cbbd36a38 proc: fix the display error of the processes field in /proc/stat
Signed-off-by: zhiguang peng <zgpeng@tencent.com>
2020-11-12 14:39:06 +08:00
Chunguang Xu fe12e6a602 ovl: ignore failure to copy up unknown xattrs
commit <7062884546a14d785c9ff6152964058211436999>

This issue came up with NFSv4 as the lower layer, which generates
"system.nfs4_acl" xattrs (even for plain old unix permissions).  Prior to
this patch this prevented copy-up from succeeding.

The overlayfs permission model mandates that permissions are checked
locally for the task and remotely for the mounter(*).  NFS4 ACLs are not
supported by the Linux kernel currently, hence they cannot be enforced
locally.  Which means it is indifferent whether this attribute is copied or
not.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-09-11 14:22:55 +08:00
Jeffle Xu fed21924a9 ext4: fix error pointer dereference
Don't pass error pointers to brelse().

commit 7159a986b420 ("ext4: fix some error pointer dereferences") has fixed
some cases, fix the remaining one case.

Once ext4_xattr_block_find()->ext4_sb_bread() failed, error pointer is
stored in @bs->bh, which will be passed to brelse() in the cleanup
routine of ext4_xattr_set_handle(). This will then cause a NULL panic
crash in __brelse().

BUG: unable to handle kernel NULL pointer dereference at 000000000000005b
RIP: 0010:__brelse+0x1b/0x50
Call Trace:
 ext4_xattr_set_handle+0x163/0x5d0
 ext4_xattr_set+0x95/0x110
 __vfs_setxattr+0x6b/0x80
 __vfs_setxattr_noperm+0x68/0x1b0
 vfs_setxattr+0xa0/0xb0
 setxattr+0x12c/0x1a0
 path_setxattr+0x8d/0xc0
 __x64_sys_setxattr+0x27/0x30
 do_syscall_64+0x60/0x250
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

In this case, @bs->bh stores '-EIO' actually.

Fixes: fb265c9cb49e ("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases")
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: stable@kernel.org # 2.6.19
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/1587628004-95123-1-git-send-email-jefflexu@linux.alibaba.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-09-11 14:22:55 +08:00
Dan Carpenter e529017e7f ext4: fix some error pointer dereferences
We can't pass error pointers to brelse().

Fixes: fb265c9cb49e ("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-09-11 14:22:55 +08:00
Chunguang Xu 0916c3f20e ext4: optimize the calculation of inode prealloc-list length
We have limited the length of the inode prealloc list, and here are
some optimizations for the calculation of the length of the list.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-09-11 14:22:55 +08:00
Chunguang Xu 13d46976f1 ext4: limit the length of per-inode prealloc list
In the scenario of writing sparse files, the Per-inode prealloc list may
be very long, resulting in high overhead for ext4_mb_use_preallocated().
To circumvent this problem, we limit the maximum length of per-inode
prealloc list to 512 and allow users to modify it.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-09-11 14:22:55 +08:00
Liu Hua 1fe0578c20 cgroup: add switch for subsystem stats isolated
Statictics of memcg, cpuset, cpuacct and blkio export by /proc/
 when switch enabled.

Signed-off-by: Liu Hua <shookliu@tencent.com>
2020-07-16 14:52:41 +08:00
chen xiaoguang e59390ab76 Revert "sched/BT: add RDT support for BT scheduler class"
This reverts commit a2119393bd.

Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>
2020-07-16 12:41:34 +08:00
Zhiping du 7204bad0ed ceph: quota: fix null pointer dereference in quota check
[upstream commit 71f2cc64d027d7]

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch fixes a possible null pointer dereference in
check_quota_exceeded, detected by the static checker smatch, with the
following warning:

   fs/ceph/quota.c:240 check_quota_exceeded()
    error: we previously assumed 'realm' could be null (see line 188)

Fixes: b7a2921765cf ("ceph: quota: support for ceph.quota.max_files")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

Signed-off-by: Zhiping Du <zhipingdu@tencent.com>
2020-07-06 14:35:32 +08:00
Xiaoming Gao 6e466f2dca build: fix series of warnings
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-06-04 18:43:47 +08:00
He Chen a2119393bd sched/BT: add RDT support for BT scheduler class
Offline tasks (BT tasks) may have some performance impact to online
tasks.
In this commit, we introduce Intel RDT features to limit offline tasks
L3 cache usage to avoid the influence caused by offline tasks.

Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-05-29 10:40:58 +08:00
Kaixu Xia 59f0f72b8a xfs: catch inode allocation state mismatch corruption and retry to allocate ino
Catch the inode allocation state mismatch corruption, and then return
an corruption error when creating a file. Retry to allocate inode and
find a fine inode no..

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-05-29 10:40:42 +08:00
brookxu b0009bfea9 writeback: eliminate work item allocation in bd_start_writeback()
commit <aac8d41cd438f25bf3110fc6b98f1d16d7dbc169>
commit <85009b4f5f0399669a44f07cb9a5622c0e71d419>

When someone calls wakeup_flusher_threads() or
wakeup_flusher_threads_bdi(), they schedule writeback of all dirty
pages in the system (or on that bdi). If we are tight on memory, we
can get tons of these queued from kswapd/vmscan. This causes (at
least) two problems:

1) We consume a ton of memory just allocating writeback work items.
   We've seen as much as 600 million of these writeback work items
   pending. That's a lot of memory to pointlessly hold hostage,
   while the box is under memory pressure.

2) We spend so much time processing these work items, that we
   introduce a softlockup in writeback processing. This is because
   each of the writeback work items don't end up doing any work (it's
   hard when you have millions of identical ones coming in to the
   flush machinery), so we just sit in a tight loop pulling work
   items and deleting/freeing them.

Fix this by adding a 'start_all' bit to the writeback structure, and
set that when someone attempts to flush all dirty pages. The bit is
cleared when we start writeback on that work item. If the bit is
already set when we attempt to queue !nr_pages writeback, then we
simply ignore it.

This provides us one full flush in flight, with one pending as well,
and makes for more efficient handling of this type of writeback.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-05-29 10:40:18 +08:00
Hongbo Li 415f265df8 net: make nfs_match_client killable
upstream commits:
950a578c6
c260121a9
9f7761cf0

Actually we don't do anything with return value from
nfs_wait_client_init_complete in nfs_match_client, as a
consequence if we get a fatal signal and client is not
fully initialised, we'll loop to "again" label

This has been proven to cause soft lockups on some scenarios
(no-carrier but configured network interfaces)

Signed-off-by: Hongbo Li <herberthbli@tencent.com>
2020-05-29 10:40:06 +08:00
Kaixu Xia 9265a637b9 xfs: remove "no-allocation" reservations for file creations
Mainly backport from upstream:
    commit f59cf5c29919d17b61913c3360a7bd29b72975c1
    Author: Christoph Hellwig <hch@lst.de>
    Date:   Mon Dec 4 17:32:55 2017 -0800

    If we create a new file we will need an inode, and usually some metadata
    in the parent direction.  Aiming for everything to go well despite the
    lack of a reservation leads to dirty transactions cancelled under a heavy
    create/delete load.  This patch removes those nospace transactions, which
    will lead to slightly earlier ENOSPC on some workloads, but instead
    prevent file system shutdowns due to cancelling dirty transactions for
    others.

    A customer could observe assertations failures and shutdowns due to
    cancelation of dirty transactions during heavy NFS workloads as shown
    below:

    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728125] XFS: Assertion failed: error != -ENOSPC, file: fs/xfs/xfs_inode.c, line: 1262

    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728222] Call Trace:
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728246]  [<ffffffff81795daf>] dump_stack+0x63/0x81
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728262]  [<ffffffff810a1a5a>] warn_slowpath_common+0x8a/0xc0
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728264]  [<ffffffff810a1b8a>] warn_slowpath_null+0x1a/0x20
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728285]  [<ffffffffa01bf403>] asswarn+0x33/0x40 [xfs]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728308]  [<ffffffffa01bb07e>] xfs_create+0x7be/0x7d0 [xfs]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728329]  [<ffffffffa01b6ffb>] xfs_generic_create+0x1fb/0x2e0 [xfs]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728348]  [<ffffffffa01b7114>] xfs_vn_mknod+0x14/0x20 [xfs]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728366]  [<ffffffffa01b7153>] xfs_vn_create+0x13/0x20 [xfs]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728380]  [<ffffffff81231de5>] vfs_create+0xd5/0x140
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728390]  [<ffffffffa045ddb9>] do_nfsd_create+0x499/0x610 [nfsd]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728396]  [<ffffffffa0465fa5>] nfsd3_proc_create+0x135/0x210 [nfsd]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728401]  [<ffffffffa04561e3>] nfsd_dispatch+0xc3/0x210 [nfsd]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728416]  [<ffffffffa03bfa43>] svc_process_common+0x453/0x6f0 [sunrpc]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728423]  [<ffffffffa03bfdf3>] svc_process+0x113/0x1f0 [sunrpc]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728427]  [<ffffffffa0455bcf>] nfsd+0x10f/0x180 [nfsd]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728432]  [<ffffffffa0455ac0>] ? nfsd_destroy+0x80/0x80 [nfsd]
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728438]  [<ffffffff810c0d58>] kthread+0xd8/0xf0
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728441]  [<ffffffff810c0c80>] ? kthread_create_on_node+0x1b0/0x1b0
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728451]  [<ffffffff8179d962>] ret_from_fork+0x42/0x70
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728453]  [<ffffffff810c0c80>] ? kthread_create_on_node+0x1b0/0x1b0
    2017-05-30 21:17:06 kernel: WARNING: [ 2670.728454] ---[ end trace f9822c842fec81d4 ]---
    2017-05-30 21:17:06 kernel: ALERT: [ 2670.728477] XFS (sdb): Internal error xfs_trans_cancel at line 983 of file fs/xfs/xfs_trans.c.  Caller xfs_create+0x4ee/0x7d0 [xfs]
    2017-05-30 21:17:06 kernel: ALERT: [ 2670.728684] XFS (sdb): Corruption of in-memory data detected. Shutting down filesystem
    2017-05-30 21:17:06 kernel: ALERT: [ 2670.728685] XFS (sdb): Please umount the filesystem and rectify the problem(s)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-05-29 10:39:43 +08:00
He Chen b48a63ef2c sched: add offline scheduler class
The offline scheduler named BT sched is based on the CFS scheduler. We
also use the rb-tree as the run queue to save the runnable tasks. And the
vruntime concept is also used in the offline scheduler. And the priority
of offline scheduler is from 140 to 179. So now the schedulers in the
kernel are as follows: stop, RT, CFS, BT and idle.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:09 +08:00
Kaixu Xia 1876e64019 ext4: fix the DIO performance regression
The commit 16c54688592c ("ext4: Allow parallel DIO reads")
causes significant performance regression in mixed random
read/write scenario since the implementation is incomplete,
so revert it.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 14:56:17 +08:00
Jan Kara 45fbf48774 ext4: fix crash during online resizing
backport from upstream commit f96c3ac8dfc2.

When computing maximum size of filesystem possible with given number of
group descriptor blocks, we forget to include s_first_data_block into
the number of blocks. Thus for filesystems with non-zero
s_first_data_block it can happen that computed maximum filesystem size
is actually lower than current filesystem size which confuses the code
and eventually leads to a BUG_ON in ext4_alloc_group_tables() hitting on
flex_gd->count == 0. The problem can be reproduced like:

truncate -s 100g /tmp/image
mkfs.ext4 -b 1024 -E resize=262144 /tmp/image 32768
mount -t ext4 -o loop /tmp/image /mnt
resize2fs /dev/loop0 262145
resize2fs /dev/loop0 300000

Fix the problem by properly including s_first_data_block into the
computed number of filesystem blocks.

Fixes: 1c6bd7173d66 "ext4: convert file system to meta_bg if needed..."
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
2020-01-02 14:55:43 +08:00
Fuhai Wang 6e3844c591 nsfs: fix netns proc warning
There are two issues in commit a0210fd669343660fc7481f2f422439dba19336c(auth_gss fix:
rpcsec_gss_exit_net has no chance to run when use-gss-proxy==1):
1. there is no chance to remove use-gss-proxy entry when use-gss-proxy does not write to 1.
2. netns evict function should be called earlier than exit function.

error log:
remove_proc_entry: removing non-empty directory 'net/rpc', leaking at least 'use-gss-proxy'
------------[ cut here ]------------
WARNING: CPU: 36 PID: 7509 at /data/rpmbuild/BUILD/kernel-4.14.105/kernel-4.14.105/fs/proc/generic.c:572 remove_proc_entry+0x1
Modules linked in: xt_nat ipt_REJECT nf_reject_ipv4 ip_set ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs xt_comment xt_mark ipt_MASQUERADE
CPU: 36 PID: 7509 Comm: kworker/u128:2 Tainted: G        W       4.14.105-19-beta4 #1
Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.53 07/04/2018
Workqueue: netns cleanup_net
task: ffff808fd7cd7000 task.stack: ffff0000253f0000
PC is at remove_proc_entry+0x100/0x138
LR is at remove_proc_entry+0x100/0x138
pc : [<ffff00000830b500>] lr : [<ffff00000830b500>] pstate: 00000145
sp : ffff0000253f3c70
x29: ffff0000253f3c70 x28: 0000000000000000
x27: ffff808fcc4b5038 x26: dead000000000200
x25: ffff0000253f3da0 x24: ffff0000253f3db0
x23: ffff0000091dd280 x22: ffff801c2b94b000
x21: ffff000009303000 x20: ffff000000bba380
x19: ffff801cef676a00 x18: 000000000000002a
x17: 0000000000000030 x16: ffff000008156e30
x15: 0000000000000000 x14: 656c20746120676e
x13: 696b61656c202c27 x12: 6370722f74656e27
x11: 2079726f74636572 x10: 6964207974706d65
x9 : ffff0000081cc960 x8 : 0000000000000004
x7 : ffff000009242000 x6 : 0000000000007a06
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 0000000000000000 x2 : ffff808ffbeee3c8
x1 : 0000808ff2e14000 x0 : 000000000000005b
Call trace:
Exception stack(0xffff0000253f3b30 to 0xffff0000253f3c70)
3b20:                                   000000000000005b 0000808ff2e14000
3b40: ffff808ffbeee3c8 0000000000000000 0000000000000000 0000000000000000
3b60: 0000000000007a06 ffff000009242000 0000000000000004 ffff0000081cc960
3b80: 6964207974706d65 2079726f74636572 6370722f74656e27 696b61656c202c27
3ba0: 656c20746120676e 0000000000000000 ffff000008156e30 0000000000000030
3bc0: 000000000000002a ffff801cef676a00 ffff000000bba380 ffff000009303000
3be0: ffff801c2b94b000 ffff0000091dd280 ffff0000253f3db0 ffff0000253f3da0
3c00: dead000000000200 ffff808fcc4b5038 0000000000000000 ffff0000253f3c70
3c20: ffff00000830b500 ffff0000253f3c70 ffff00000830b500 0000000000000145
3c40: ffff801c2b94b08d ffff801cef676a8d ffffffffffffffff 0000000000000000
3c60: ffff0000253f3c70 ffff00000830b500
[<ffff00000830b500>] remove_proc_entry+0x100/0x138
[<ffff000000badba0>] rpc_proc_exit+0x40/0x50 [sunrpc]
[<ffff000000ba3524>] sunrpc_exit_net+0x34/0x40 [sunrpc]
[<ffff000008a03784>] ops_exit_list.isra.3+0x4c/0x80
[<ffff000008a04170>] cleanup_net+0x1b0/0x2c0
[<ffff0000080e8558>] process_one_work+0x1f8/0x420
[<ffff0000080e87cc>] worker_thread+0x4c/0x470
[<ffff0000080eed7c>] kthread+0x134/0x138
[<ffff000008084f7c>] ret_from_fork+0x10/0x1c

Fixes: a0210fd669343660fc7481f2f422439dba19336c ("auth_gss fix: rpcsec_gss_exit_net has no chance to run when use-gss-proxy==1

Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2020-01-02 14:55:31 +08:00
Kaixu Xia 44a72efebd xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()
Backport from the mainline kernel:
	commit 93597ae8dac0149b5c00b787cba6bf7ba213e666

Fix deadlock between AGI and AGF when target_ip exists in xfs_rename().

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[darrick: reword the comment]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2020-01-02 14:55:23 +08:00
Kaixu Xia f8c4b7aac0 xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT
Backport from the mainline kernel:
	commit bc56ad8c74b8588685c2875de0df8ab6974828ef
	commit 3fb21fc8cc04e9a75a426510dfe597f0d0b19134

Fix deadlock between AGI and AGF with RENAME_WHITEOUT.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2020-01-02 14:54:49 +08:00
Fuhai Wang 9d289d8cff epoll: introduce min_wait_time
epoll hrtimer patch may increase loop times if timeout set to 1ms.
This patch add new sysctl control the minimal wait time, and default
to 1 jiffies.

Signed-off-by: Samuel Liao <samuelliao@tencent.com>
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2020-01-02 14:53:48 +08:00
Fuhai Wang b068df7b27 Revert "epoll: introduce min_wait_time" 2020-01-02 14:53:11 +08:00
Xiaoming Gao 1159977f4d ceph: quota: report root dir quota usage in statfs
This commit changes statfs default behaviour when reporting usage
statistics.  Instead of using the overall filesystem usage, statfs now
reports the quota for the filesystem root, if ceph.quota.max_bytes has
been set for this inode.  If quota hasn't been set, it falls back to the
old statfs behaviour.

A new mount option is also added ('noquotadf') to disable this behaviour.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 12:23:38 +08:00
Luis Henriques 2427d4b2e0 ceph: quota: add counter for snaprealms with quota
By keeping a counter with the number of snaprealms that have quota set
allows to optimize the functions that need to walk throught the realms
hierarchy looking for quotas.  Thus, if this counter is zero it's safe to
assume that there are no realms with quota.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:33 +08:00
Luis Henriques ca68edcbf6 ceph: quota: cache inode pointer in ceph_snap_realm
Keep a pointer to the inode in struct ceph_snap_realm.  This allows to
optimize functions that walk the realms hierarchy (e.g. in quotas).

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:30 +08:00
Yan, Zheng 8856144bba ceph: fix root quota realm check
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:27 +08:00
Yan, Zheng 68803f797c ceph: don't check quota for snap inode
snap inode's i_snap_realm is not pointing to ceph_snap_realm.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:23 +08:00
Luis Henriques 9cfb319544 ceph: quota: update MDS when max_bytes is approaching
When we're reaching the ceph.quota.max_bytes limit, i.e., when writing
more than 1/16th of the space left in a quota realm, update the MDS with
the new file size.

This mirrors the fuse-client approach with commit 122c50315ed1 ("client:
Inform mds file size when approaching quota limit"), in the ceph git tree.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:20 +08:00
Luis Henriques e90cd3f1b1 ceph: quota: support for ceph.quota.max_bytes
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:18 +08:00
Luis Henriques 915f852a6f ceph: quota: don't allow cross-quota renames
This patch changes ceph_rename so that -EXDEV is returned if an attempt is
made to mv a file between two different dir trees with different quotas
setup.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:14 +08:00
Luis Henriques 4b710dc7c3 ceph: quota: support for ceph.quota.max_files
This patch adds support for the max_files quota.  It hooks into all the
ceph functions that add new filesystem objects that need to be checked
against the quota limits.  When these limits are hit, -EDQUOT is returned.

Note that we're not checking quotas on ceph_link().  ceph_link doesn't
really create a new inode,  and since the MDS doesn't update the directory
statistics when a new (hard) link is created (only with symlinks), they
are not accounted as a new file.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:11 +08:00
Luis Henriques 78b249729b ceph: quota: add initial infrastructure to support cephfs quotas
This patch adds the infrastructure required to support cephfs quotas as it
is currently implemented in the ceph fuse client.  Cephfs quotas can be
set on any directory, and can restrict the number of bytes or the number
of files stored beneath that point in the directory hierarchy.

Quotas are set using the extended attributes 'ceph.quota.max_files' and
'ceph.quota.max_bytes', and can be removed by setting these attributes to
'0'.

Link: http://tracker.ceph.com/issues/22372
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:05 +08:00
brookxu f22307c4c8 cpuset: fixed cpuset.stat process field value exception
The value of the cpuset.stat process field will be abnormal in
some scenarios. The reason for this problem is that the sum of
process_counts may be negative for several cpus.

Signed-off-by: brookxu <brookxu@tencent.com>
2020-01-02 12:20:45 +08:00
Wenbin Zeng 4caf63c8ab auth_gss fix: rpcsec_gss_exit_net has no chance to run when use-gss-proxy==1
When use-gss-proxy is set to 1, write_gssp will lead to 2 get_net calls
in gssp_rpc_create, the paired put_net calls are supposed to be made
in rpcsec_gss_net_ops->exit i.e. rpcsec_gss_exit_net, but this will
never happen because rpcsec_gss_exit_net (via ops_exit_list) is called
by cleanup_net and cleanup_net will never run unless net->count becomes
0, since the paired put_net calls of gssp_rpc_create are not made yet,
net->count cannot drop to 0. This is dead lock situation.

This fix introduced a new method i.e. evict in struct proc_ns_operations,
which is called in nsfs_evict, moving rpcsec_gss_exit_net into the code
path of nsfs_evict gives it a chance to run.

Signed-off-by: Wenbin Zeng <wenbinzeng@tencent.com>
2020-01-02 12:13:47 +08:00
Kaixu Xia f9e0e91cd7 xfs: validate sb_logsunit is a multiple of the fs blocksize
Make sure the log stripe unit is sane before proceeding with mounting.
AFAICT this means that logsunit has to be 0, 1, or a multiple of the fs
block size.  Found this by setting the LSB of logsunit in xfs/350 and
watching the system crash as soon as we try to write to the log.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 12:10:49 +08:00
Kaixu Xia 954836b8d1 mounts: add shield mountpoint in container support
Add shield mountpoint in container support
$ echo "set /dev/name /mnt/point" >/proc/tkernel/shield_mounts
to shield the mountpoint
$ echo "clear /dev/name /mnt/point" >/proc/tkernel/shield_mounts
to delete the mountpoint shielded

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Weiwei Li <nuonuoli@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 11:55:00 +08:00
Kaixu Xia 88513dc458 xfs: add kmem_alloc_by_vmalloc and kmem_alloc_large_dump_stack sysctl
Add dump stack logic when kmem_alloc failed.

kmem_alloc_by_vmalloc: when kmem_alloc size larger than PAGE_SIZE*kmem_alloc_by_vmalloc,
use vmalloc instead kmalloc.
kmem_alloc_large_dump_stack: dump info and stack when kmem_alloc size
larger than PAGE_SIZE*kmem_alloc_by_vmalloc.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 11:54:24 +08:00
Xiaoming Gao c6b4290a20 xfs: set xfs default error level to 5
we need more information when xfs report corruption.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 11:53:51 +08:00
Lorin Liu 3dd54ca17c proc: add pid mapping between host and container
create a pid mapping data to parent processes in file  /proc/$PID/status
create a proc file (/proc/$PID/hostinfo), mapping pid data to host pid

Signed-off-by: Lorin Liu <lorinliu@tencent.com>
2020-01-02 11:44:36 +08:00
Xiaoming Gao 78a8c3c2c2 Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 10:51:04 +08:00