aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds2017-05-08 20:17:56 -0500
committerLinus Torvalds2017-05-08 20:17:56 -0500
commitbf5f89463f5b3109a72ed13ca62b57e90213387d (patch)
treef9f288a341dd86efa996f7a08fb425eae34eb446 /fs
parent2d3e4866dea96b0506395b47bfefb234f2088dac (diff)
parent4d2b5bcab53f1c76a86279339561c9a36109a93b (diff)
downloadkernel-bf5f89463f5b3109a72ed13ca62b57e90213387d.tar.gz
kernel-bf5f89463f5b3109a72ed13ca62b57e90213387d.tar.xz
kernel-bf5f89463f5b3109a72ed13ca62b57e90213387d.zip
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - the rest of MM - various misc things - procfs updates - lib/ updates - checkpatch updates - kdump/kexec updates - add kvmalloc helpers, use them - time helper updates for Y2038 issues. We're almost ready to remove current_fs_time() but that awaits a btrfs merge. - add tracepoints to DAX * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits) drivers/staging/ccree/ssi_hash.c: fix build with gcc-4.4.4 selftests/vm: add a test for virtual address range mapping dax: add tracepoint to dax_insert_mapping() dax: add tracepoint to dax_writeback_one() dax: add tracepoints to dax_writeback_mapping_range() dax: add tracepoints to dax_load_hole() dax: add tracepoints to dax_pfn_mkwrite() dax: add tracepoints to dax_iomap_pte_fault() mtd: nand: nandsim: convert to memalloc_noreclaim_*() treewide: convert PF_MEMALLOC manipulations to new helpers mm: introduce memalloc_noreclaim_{save,restore} mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC mm/huge_memory.c: deposit a pgtable for DAX PMD faults when required mm/huge_memory.c: use zap_deposited_table() more time: delete CURRENT_TIME_SEC and CURRENT_TIME gfs2: replace CURRENT_TIME with current_time apparmorfs: replace CURRENT_TIME with current_time() lustre: replace CURRENT_TIME macro fs: ubifs: replace CURRENT_TIME_SEC with current_time fs: ufs: use ktime_get_real_ts64() for birthtime ...
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c9
-rw-r--r--fs/btrfs/free-space-tree.c3
-rw-r--r--fs/btrfs/ioctl.c9
-rw-r--r--fs/btrfs/send.c27
-rw-r--r--fs/buffer.c13
-rw-r--r--fs/ceph/file.c9
-rw-r--r--fs/ceph/mds_client.c4
-rw-r--r--fs/cifs/cifsencrypt.c4
-rw-r--r--fs/cifs/cifssmb.c10
-rw-r--r--fs/cifs/inode.c28
-rw-r--r--fs/dax.c48
-rw-r--r--fs/exofs/dir.c3
-rw-r--r--fs/ext4/mballoc.c2
-rw-r--r--fs/ext4/super.c4
-rw-r--r--fs/f2fs/f2fs.h20
-rw-r--r--fs/f2fs/file.c4
-rw-r--r--fs/f2fs/node.c6
-rw-r--r--fs/f2fs/segment.c16
-rw-r--r--fs/f2fs/segment.h5
-rw-r--r--fs/file.c2
-rw-r--r--fs/gfs2/bmap.c4
-rw-r--r--fs/hfs/extent.c4
-rw-r--r--fs/hfsplus/extents.c5
-rw-r--r--fs/inode.c2
-rw-r--r--fs/iomap.c13
-rw-r--r--fs/namei.c2
-rw-r--r--fs/nsfs.c4
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/namespaces.c1
-rw-r--r--fs/reiserfs/item_ops.c24
-rw-r--r--fs/select.c5
-rw-r--r--fs/seq_file.c16
-rw-r--r--fs/ubifs/dir.c12
-rw-r--r--fs/ubifs/file.c12
-rw-r--r--fs/ubifs/ioctl.c2
-rw-r--r--fs/ubifs/misc.h10
-rw-r--r--fs/ubifs/sb.c14
-rw-r--r--fs/ubifs/xattr.c6
-rw-r--r--fs/ufs/ialloc.c6
-rw-r--r--fs/xattr.c27
-rw-r--r--fs/xfs/kmem.c2
-rw-r--r--fs/xfs/xfs_log_recover.c2
42 files changed, 176 insertions, 225 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 7dc8844037e0..1c3b6c54d5ee 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5392,13 +5392,10 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
5392 goto out; 5392 goto out;
5393 } 5393 }
5394 5394
5395 tmp_buf = kmalloc(fs_info->nodesize, GFP_KERNEL | __GFP_NOWARN); 5395 tmp_buf = kvmalloc(fs_info->nodesize, GFP_KERNEL);
5396 if (!tmp_buf) { 5396 if (!tmp_buf) {
5397 tmp_buf = vmalloc(fs_info->nodesize); 5397 ret = -ENOMEM;
5398 if (!tmp_buf) { 5398 goto out;
5399 ret = -ENOMEM;
5400 goto out;
5401 }
5402 } 5399 }
5403 5400
5404 left_path->search_commit_root = 1; 5401 left_path->search_commit_root = 1;
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index dd7fb22a955a..fc0bd8406758 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -167,8 +167,7 @@ static u8 *alloc_bitmap(u32 bitmap_size)
167 if (mem) 167 if (mem)
168 return mem; 168 return mem;
169 169
170 return __vmalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO, 170 return __vmalloc(bitmap_size, GFP_NOFS | __GFP_ZERO, PAGE_KERNEL);
171 PAGE_KERNEL);
172} 171}
173 172
174int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans, 173int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index dabfc7ac48a6..922a66fce401 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3539,12 +3539,9 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
3539 u64 last_dest_end = destoff; 3539 u64 last_dest_end = destoff;
3540 3540
3541 ret = -ENOMEM; 3541 ret = -ENOMEM;
3542 buf = kmalloc(fs_info->nodesize, GFP_KERNEL | __GFP_NOWARN); 3542 buf = kvmalloc(fs_info->nodesize, GFP_KERNEL);
3543 if (!buf) { 3543 if (!buf)
3544 buf = vmalloc(fs_info->nodesize); 3544 return ret;
3545 if (!buf)
3546 return ret;
3547 }
3548 3545
3549 path = btrfs_alloc_path(); 3546 path = btrfs_alloc_path();
3550 if (!path) { 3547 if (!path) {
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index a60d5bfb8a49..3f645cd67b54 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6360,22 +6360,16 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
6360 sctx->clone_roots_cnt = arg->clone_sources_count; 6360 sctx->clone_roots_cnt = arg->clone_sources_count;
6361 6361
6362 sctx->send_max_size = BTRFS_SEND_BUF_SIZE; 6362 sctx->send_max_size = BTRFS_SEND_BUF_SIZE;
6363 sctx->send_buf = kmalloc(sctx->send_max_size, GFP_KERNEL | __GFP_NOWARN); 6363 sctx->send_buf = kvmalloc(sctx->send_max_size, GFP_KERNEL);
6364 if (!sctx->send_buf) { 6364 if (!sctx->send_buf) {
6365 sctx->send_buf = vmalloc(sctx->send_max_size); 6365 ret = -ENOMEM;
6366 if (!sctx->send_buf) { 6366 goto out;
6367 ret = -ENOMEM;
6368 goto out;
6369 }
6370 } 6367 }
6371 6368
6372 sctx->read_buf = kmalloc(BTRFS_SEND_READ_SIZE, GFP_KERNEL | __GFP_NOWARN); 6369 sctx->read_buf = kvmalloc(BTRFS_SEND_READ_SIZE, GFP_KERNEL);
6373 if (!sctx->read_buf) { 6370 if (!sctx->read_buf) {
6374 sctx->read_buf = vmalloc(BTRFS_SEND_READ_SIZE); 6371 ret = -ENOMEM;
6375 if (!sctx->read_buf) { 6372 goto out;
6376 ret = -ENOMEM;
6377 goto out;
6378 }
6379 } 6373 }
6380 6374
6381 sctx->pending_dir_moves = RB_ROOT; 6375 sctx->pending_dir_moves = RB_ROOT;
@@ -6396,13 +6390,10 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
6396 alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources); 6390 alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources);
6397 6391
6398 if (arg->clone_sources_count) { 6392 if (arg->clone_sources_count) {
6399 clone_sources_tmp = kmalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN); 6393 clone_sources_tmp = kvmalloc(alloc_size, GFP_KERNEL);
6400 if (!clone_sources_tmp) { 6394 if (!clone_sources_tmp) {
6401 clone_sources_tmp = vmalloc(alloc_size); 6395 ret = -ENOMEM;
6402 if (!clone_sources_tmp) { 6396 goto out;
6403 ret = -ENOMEM;
6404 goto out;
6405 }
6406 } 6397 }
6407 6398
6408 ret = copy_from_user(clone_sources_tmp, arg->clone_sources, 6399 ret = copy_from_user(clone_sources_tmp, arg->clone_sources,
diff --git a/fs/buffer.c b/fs/buffer.c
index 9196f2a270da..c3c7455efa3f 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2379,8 +2379,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
2379 goto out; 2379 goto out;
2380 2380
2381 err = pagecache_write_begin(NULL, mapping, size, 0, 2381 err = pagecache_write_begin(NULL, mapping, size, 0,
2382 AOP_FLAG_UNINTERRUPTIBLE|AOP_FLAG_CONT_EXPAND, 2382 AOP_FLAG_CONT_EXPAND, &page, &fsdata);
2383 &page, &fsdata);
2384 if (err) 2383 if (err)
2385 goto out; 2384 goto out;
2386 2385
@@ -2415,9 +2414,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
2415 } 2414 }
2416 len = PAGE_SIZE - zerofrom; 2415 len = PAGE_SIZE - zerofrom;
2417 2416
2418 err = pagecache_write_begin(file, mapping, curpos, len, 2417 err = pagecache_write_begin(file, mapping, curpos, len, 0,
2419 AOP_FLAG_UNINTERRUPTIBLE, 2418 &page, &fsdata);
2420 &page, &fsdata);
2421 if (err) 2419 if (err)
2422 goto out; 2420 goto out;
2423 zero_user(page, zerofrom, len); 2421 zero_user(page, zerofrom, len);
@@ -2449,9 +2447,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
2449 } 2447 }
2450 len = offset - zerofrom; 2448 len = offset - zerofrom;
2451 2449
2452 err = pagecache_write_begin(file, mapping, curpos, len, 2450 err = pagecache_write_begin(file, mapping, curpos, len, 0,
2453 AOP_FLAG_UNINTERRUPTIBLE, 2451 &page, &fsdata);
2454 &page, &fsdata);
2455 if (err) 2452 if (err)
2456 goto out; 2453 goto out;
2457 zero_user(page, zerofrom, len); 2454 zero_user(page, zerofrom, len);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 26cc95421cca..18c045e2ead6 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -74,12 +74,9 @@ dio_get_pages_alloc(const struct iov_iter *it, size_t nbytes,
74 align = (unsigned long)(it->iov->iov_base + it->iov_offset) & 74 align = (unsigned long)(it->iov->iov_base + it->iov_offset) &
75 (PAGE_SIZE - 1); 75 (PAGE_SIZE - 1);
76 npages = calc_pages_for(align, nbytes); 76 npages = calc_pages_for(align, nbytes);
77 pages = kmalloc(sizeof(*pages) * npages, GFP_KERNEL); 77 pages = kvmalloc(sizeof(*pages) * npages, GFP_KERNEL);
78 if (!pages) { 78 if (!pages)
79 pages = vmalloc(sizeof(*pages) * npages); 79 return ERR_PTR(-ENOMEM);
80 if (!pages)
81 return ERR_PTR(-ENOMEM);
82 }
83 80
84 for (idx = 0; idx < npages; ) { 81 for (idx = 0; idx < npages; ) {
85 size_t start; 82 size_t start;
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index c681762d76e6..1d3fa90d40b9 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1666,6 +1666,7 @@ struct ceph_mds_request *
1666ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode) 1666ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
1667{ 1667{
1668 struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS); 1668 struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS);
1669 struct timespec ts;
1669 1670
1670 if (!req) 1671 if (!req)
1671 return ERR_PTR(-ENOMEM); 1672 return ERR_PTR(-ENOMEM);
@@ -1684,7 +1685,8 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
1684 init_completion(&req->r_safe_completion); 1685 init_completion(&req->r_safe_completion);
1685 INIT_LIST_HEAD(&req->r_unsafe_item); 1686 INIT_LIST_HEAD(&req->r_unsafe_item);
1686 1687
1687 req->r_stamp = current_fs_time(mdsc->fsc->sb); 1688 ktime_get_real_ts(&ts);
1689 req->r_stamp = timespec_trunc(ts, mdsc->fsc->sb->s_time_gran);
1688 1690
1689 req->r_op = op; 1691 req->r_op = op;
1690 req->r_direct_mode = mode; 1692 req->r_direct_mode = mode;
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 058ac9b36f04..68abbb0db608 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -478,6 +478,7 @@ find_timestamp(struct cifs_ses *ses)
478 unsigned char *blobptr; 478 unsigned char *blobptr;
479 unsigned char *blobend; 479 unsigned char *blobend;
480 struct ntlmssp2_name *attrptr; 480 struct ntlmssp2_name *attrptr;
481 struct timespec ts;
481 482
482 if (!ses->auth_key.len || !ses->auth_key.response) 483 if (!ses->auth_key.len || !ses->auth_key.response)
483 return 0; 484 return 0;
@@ -502,7 +503,8 @@ find_timestamp(struct cifs_ses *ses)
502 blobptr += attrsize; /* advance attr value */ 503 blobptr += attrsize; /* advance attr value */
503 } 504 }
504 505
505 return cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); 506 ktime_get_real_ts(&ts);
507 return cpu_to_le64(cifs_UnixTimeToNT(ts));
506} 508}
507 509
508static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, 510static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 205fd94f52fd..4c01b3f9abf0 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -478,14 +478,14 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr)
478 * this requirement. 478 * this requirement.
479 */ 479 */
480 int val, seconds, remain, result; 480 int val, seconds, remain, result;
481 struct timespec ts, utc; 481 struct timespec ts;
482 utc = CURRENT_TIME; 482 unsigned long utc = ktime_get_real_seconds();
483 ts = cnvrtDosUnixTm(rsp->SrvTime.Date, 483 ts = cnvrtDosUnixTm(rsp->SrvTime.Date,
484 rsp->SrvTime.Time, 0); 484 rsp->SrvTime.Time, 0);
485 cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n", 485 cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n",
486 (int)ts.tv_sec, (int)utc.tv_sec, 486 (int)ts.tv_sec, (int)utc,
487 (int)(utc.tv_sec - ts.tv_sec)); 487 (int)(utc - ts.tv_sec));
488 val = (int)(utc.tv_sec - ts.tv_sec); 488 val = (int)(utc - ts.tv_sec);
489 seconds = abs(val); 489 seconds = abs(val);
490 result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ; 490 result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ;
491 remain = seconds % MIN_TZ_ADJ; 491 remain = seconds % MIN_TZ_ADJ;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index b261db34103c..c3b2fa0b2ec8 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -322,9 +322,9 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
322 fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU; 322 fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU;
323 fattr->cf_uid = cifs_sb->mnt_uid; 323 fattr->cf_uid = cifs_sb->mnt_uid;
324 fattr->cf_gid = cifs_sb->mnt_gid; 324 fattr->cf_gid = cifs_sb->mnt_gid;
325 fattr->cf_atime = CURRENT_TIME; 325 ktime_get_real_ts(&fattr->cf_mtime);
326 fattr->cf_ctime = CURRENT_TIME; 326 fattr->cf_mtime = timespec_trunc(fattr->cf_mtime, sb->s_time_gran);
327 fattr->cf_mtime = CURRENT_TIME; 327 fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime;
328 fattr->cf_nlink = 2; 328 fattr->cf_nlink = 2;
329 fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL; 329 fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL;
330} 330}
@@ -586,9 +586,10 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
586/* Fill a cifs_fattr struct with info from FILE_ALL_INFO */ 586/* Fill a cifs_fattr struct with info from FILE_ALL_INFO */
587static void 587static void
588cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, 588cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
589 struct cifs_sb_info *cifs_sb, bool adjust_tz, 589 struct super_block *sb, bool adjust_tz,
590 bool symlink) 590 bool symlink)
591{ 591{
592 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
592 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); 593 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
593 594
594 memset(fattr, 0, sizeof(*fattr)); 595 memset(fattr, 0, sizeof(*fattr));
@@ -598,8 +599,10 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
598 599
599 if (info->LastAccessTime) 600 if (info->LastAccessTime)
600 fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime); 601 fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
601 else 602 else {
602 fattr->cf_atime = CURRENT_TIME; 603 ktime_get_real_ts(&fattr->cf_atime);
604 fattr->cf_atime = timespec_trunc(fattr->cf_atime, sb->s_time_gran);
605 }
603 606
604 fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime); 607 fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime);
605 fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); 608 fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
@@ -659,7 +662,6 @@ cifs_get_file_info(struct file *filp)
659 FILE_ALL_INFO find_data; 662 FILE_ALL_INFO find_data;
660 struct cifs_fattr fattr; 663 struct cifs_fattr fattr;
661 struct inode *inode = file_inode(filp); 664 struct inode *inode = file_inode(filp);
662 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
663 struct cifsFileInfo *cfile = filp->private_data; 665 struct cifsFileInfo *cfile = filp->private_data;
664 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 666 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
665 struct TCP_Server_Info *server = tcon->ses->server; 667 struct TCP_Server_Info *server = tcon->ses->server;
@@ -671,7 +673,7 @@ cifs_get_file_info(struct file *filp)
671 rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data); 673 rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data);
672 switch (rc) { 674 switch (rc) {
673 case 0: 675 case 0:
674 cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false, 676 cifs_all_info_to_fattr(&fattr, &find_data, inode->i_sb, false,
675 false); 677 false);
676 break; 678 break;
677 case -EREMOTE: 679 case -EREMOTE:
@@ -753,7 +755,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
753 } 755 }
754 756
755 if (!rc) { 757 if (!rc) {
756 cifs_all_info_to_fattr(&fattr, data, cifs_sb, adjust_tz, 758 cifs_all_info_to_fattr(&fattr, data, sb, adjust_tz,
757 symlink); 759 symlink);
758 } else if (rc == -EREMOTE) { 760 } else if (rc == -EREMOTE) {
759 cifs_create_dfs_fattr(&fattr, sb); 761 cifs_create_dfs_fattr(&fattr, sb);
@@ -1363,9 +1365,9 @@ out_reval:
1363 cifs_inode = CIFS_I(inode); 1365 cifs_inode = CIFS_I(inode);
1364 cifs_inode->time = 0; /* will force revalidate to get info 1366 cifs_inode->time = 0; /* will force revalidate to get info
1365 when needed */ 1367 when needed */
1366 inode->i_ctime = current_fs_time(sb); 1368 inode->i_ctime = current_time(inode);
1367 } 1369 }
1368 dir->i_ctime = dir->i_mtime = current_fs_time(sb); 1370 dir->i_ctime = dir->i_mtime = current_time(dir);
1369 cifs_inode = CIFS_I(dir); 1371 cifs_inode = CIFS_I(dir);
1370 CIFS_I(dir)->time = 0; /* force revalidate of dir as well */ 1372 CIFS_I(dir)->time = 0; /* force revalidate of dir as well */
1371unlink_out: 1373unlink_out:
@@ -1633,7 +1635,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1633 cifsInode->time = 0; 1635 cifsInode->time = 0;
1634 1636
1635 d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime = 1637 d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime =
1636 current_fs_time(inode->i_sb); 1638 current_time(inode);
1637 1639
1638rmdir_exit: 1640rmdir_exit:
1639 kfree(full_path); 1641 kfree(full_path);
@@ -1806,7 +1808,7 @@ unlink_target:
1806 CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; 1808 CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0;
1807 1809
1808 source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = 1810 source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime =
1809 target_dir->i_mtime = current_fs_time(source_dir->i_sb); 1811 target_dir->i_mtime = current_time(source_dir);
1810 1812
1811cifs_rename_exit: 1813cifs_rename_exit:
1812 kfree(info_buf_source); 1814 kfree(info_buf_source);
diff --git a/fs/dax.c b/fs/dax.c
index 43bbd6d1037d..66d79067eedf 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -509,21 +509,25 @@ int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
509static int dax_load_hole(struct address_space *mapping, void **entry, 509static int dax_load_hole(struct address_space *mapping, void **entry,
510 struct vm_fault *vmf) 510 struct vm_fault *vmf)
511{ 511{
512 struct inode *inode = mapping->host;
512 struct page *page; 513 struct page *page;
513 int ret; 514 int ret;
514 515
515 /* Hole page already exists? Return it... */ 516 /* Hole page already exists? Return it... */
516 if (!radix_tree_exceptional_entry(*entry)) { 517 if (!radix_tree_exceptional_entry(*entry)) {
517 page = *entry; 518 page = *entry;
518 goto out; 519 goto finish_fault;
519 } 520 }
520 521
521 /* This will replace locked radix tree entry with a hole page */ 522 /* This will replace locked radix tree entry with a hole page */
522 page = find_or_create_page(mapping, vmf->pgoff, 523 page = find_or_create_page(mapping, vmf->pgoff,
523 vmf->gfp_mask | __GFP_ZERO); 524 vmf->gfp_mask | __GFP_ZERO);
524 if (!page) 525 if (!page) {
525 return VM_FAULT_OOM; 526 ret = VM_FAULT_OOM;
526 out: 527 goto out;
528 }
529
530finish_fault:
527 vmf->page = page; 531 vmf->page = page;
528 ret = finish_fault(vmf); 532 ret = finish_fault(vmf);
529 vmf->page = NULL; 533 vmf->page = NULL;
@@ -531,8 +535,10 @@ static int dax_load_hole(struct address_space *mapping, void **entry,
531 if (!ret) { 535 if (!ret) {
532 /* Grab reference for PTE that is now referencing the page */ 536 /* Grab reference for PTE that is now referencing the page */
533 get_page(page); 537 get_page(page);
534 return VM_FAULT_NOPAGE; 538 ret = VM_FAULT_NOPAGE;
535 } 539 }
540out:
541 trace_dax_load_hole(inode, vmf, ret);
536 return ret; 542 return ret;
537} 543}
538 544
@@ -817,6 +823,7 @@ static int dax_writeback_one(struct block_device *bdev,
817 spin_lock_irq(&mapping->tree_lock); 823 spin_lock_irq(&mapping->tree_lock);
818 radix_tree_tag_clear(page_tree, index, PAGECACHE_TAG_DIRTY); 824 radix_tree_tag_clear(page_tree, index, PAGECACHE_TAG_DIRTY);
819 spin_unlock_irq(&mapping->tree_lock); 825 spin_unlock_irq(&mapping->tree_lock);
826 trace_dax_writeback_one(mapping->host, index, size >> PAGE_SHIFT);
820 dax_unlock: 827 dax_unlock:
821 dax_read_unlock(id); 828 dax_read_unlock(id);
822 put_locked_mapping_entry(mapping, index, entry); 829 put_locked_mapping_entry(mapping, index, entry);
@@ -857,6 +864,8 @@ int dax_writeback_mapping_range(struct address_space *mapping,
857 start_index = wbc->range_start >> PAGE_SHIFT; 864 start_index = wbc->range_start >> PAGE_SHIFT;
858 end_index = wbc->range_end >> PAGE_SHIFT; 865 end_index = wbc->range_end >> PAGE_SHIFT;
859 866
867 trace_dax_writeback_range(inode, start_index, end_index);
868
860 tag_pages_for_writeback(mapping, start_index, end_index); 869 tag_pages_for_writeback(mapping, start_index, end_index);
861 870
862 pagevec_init(&pvec, 0); 871 pagevec_init(&pvec, 0);
@@ -876,14 +885,14 @@ int dax_writeback_mapping_range(struct address_space *mapping,
876 885
877 ret = dax_writeback_one(bdev, dax_dev, mapping, 886 ret = dax_writeback_one(bdev, dax_dev, mapping,
878 indices[i], pvec.pages[i]); 887 indices[i], pvec.pages[i]);
879 if (ret < 0) { 888 if (ret < 0)
880 put_dax(dax_dev); 889 goto out;
881 return ret;
882 }
883 } 890 }
884 } 891 }
892out:
885 put_dax(dax_dev); 893 put_dax(dax_dev);
886 return 0; 894 trace_dax_writeback_range_done(inode, start_index, end_index);
895 return (ret < 0 ? ret : 0);
887} 896}
888EXPORT_SYMBOL_GPL(dax_writeback_mapping_range); 897EXPORT_SYMBOL_GPL(dax_writeback_mapping_range);
889 898
@@ -916,6 +925,7 @@ static int dax_insert_mapping(struct address_space *mapping,
916 return PTR_ERR(ret); 925 return PTR_ERR(ret);
917 *entryp = ret; 926 *entryp = ret;
918 927
928 trace_dax_insert_mapping(mapping->host, vmf, ret);
919 return vm_insert_mixed(vma, vaddr, pfn); 929 return vm_insert_mixed(vma, vaddr, pfn);
920} 930}
921 931
@@ -927,6 +937,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
927{ 937{
928 struct file *file = vmf->vma->vm_file; 938 struct file *file = vmf->vma->vm_file;
929 struct address_space *mapping = file->f_mapping; 939 struct address_space *mapping = file->f_mapping;
940 struct inode *inode = mapping->host;
930 void *entry, **slot; 941 void *entry, **slot;
931 pgoff_t index = vmf->pgoff; 942 pgoff_t index = vmf->pgoff;
932 943
@@ -936,6 +947,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
936 if (entry) 947 if (entry)
937 put_unlocked_mapping_entry(mapping, index, entry); 948 put_unlocked_mapping_entry(mapping, index, entry);
938 spin_unlock_irq(&mapping->tree_lock); 949 spin_unlock_irq(&mapping->tree_lock);
950 trace_dax_pfn_mkwrite_no_entry(inode, vmf, VM_FAULT_NOPAGE);
939 return VM_FAULT_NOPAGE; 951 return VM_FAULT_NOPAGE;
940 } 952 }
941 radix_tree_tag_set(&mapping->page_tree, index, PAGECACHE_TAG_DIRTY); 953 radix_tree_tag_set(&mapping->page_tree, index, PAGECACHE_TAG_DIRTY);
@@ -948,6 +960,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
948 */ 960 */
949 finish_mkwrite_fault(vmf); 961 finish_mkwrite_fault(vmf);
950 put_locked_mapping_entry(mapping, index, entry); 962 put_locked_mapping_entry(mapping, index, entry);
963 trace_dax_pfn_mkwrite(inode, vmf, VM_FAULT_NOPAGE);
951 return VM_FAULT_NOPAGE; 964 return VM_FAULT_NOPAGE;
952} 965}
953EXPORT_SYMBOL_GPL(dax_pfn_mkwrite); 966EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
@@ -1150,13 +1163,16 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
1150 int vmf_ret = 0; 1163 int vmf_ret = 0;
1151 void *entry; 1164 void *entry;
1152 1165
1166 trace_dax_pte_fault(inode, vmf, vmf_ret);
1153 /* 1167 /*
1154 * Check whether offset isn't beyond end of file now. Caller is supposed 1168 * Check whether offset isn't beyond end of file now. Caller is supposed
1155 * to hold locks serializing us with truncate / punch hole so this is 1169 * to hold locks serializing us with truncate / punch hole so this is
1156 * a reliable test. 1170 * a reliable test.
1157 */ 1171 */
1158 if (pos >= i_size_read(inode)) 1172 if (pos >= i_size_read(inode)) {
1159 return VM_FAULT_SIGBUS; 1173 vmf_ret = VM_FAULT_SIGBUS;
1174 goto out;
1175 }
1160 1176
1161 if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page) 1177 if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page)
1162 flags |= IOMAP_WRITE; 1178 flags |= IOMAP_WRITE;
@@ -1167,8 +1183,10 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
1167 * that we never have to deal with more than a single extent here. 1183 * that we never have to deal with more than a single extent here.
1168 */ 1184 */
1169 error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap); 1185 error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap);
1170 if (error) 1186 if (error) {
1171 return dax_fault_return(error); 1187 vmf_ret = dax_fault_return(error);
1188 goto out;
1189 }
1172 if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) { 1190 if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) {
1173 vmf_ret = dax_fault_return(-EIO); /* fs corruption? */ 1191 vmf_ret = dax_fault_return(-EIO); /* fs corruption? */
1174 goto finish_iomap; 1192 goto finish_iomap;
@@ -1252,6 +1270,8 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
1252 */ 1270 */
1253 ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap); 1271 ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap);
1254 } 1272 }
1273out:
1274 trace_dax_pte_fault_done(inode, vmf, vmf_ret);
1255 return vmf_ret; 1275 return vmf_ret;
1256} 1276}
1257 1277
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index 42f9a0a0c4ca..8eeb694332fe 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -405,8 +405,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de,
405 int err; 405 int err;
406 406
407 lock_page(page); 407 lock_page(page);
408 err = exofs_write_begin(NULL, page->mapping, pos, len, 408 err = exofs_write_begin(NULL, page->mapping, pos, len, 0, &page, NULL);
409 AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
410 if (err) 409 if (err)
411 EXOFS_ERR("exofs_set_link: exofs_write_begin FAILED => %d\n", 410 EXOFS_ERR("exofs_set_link: exofs_write_begin FAILED => %d\n",
412 err); 411 err);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 36de58a37653..5083bce20ac4 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2393,7 +2393,7 @@ int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)
2393 return 0; 2393 return 0;
2394 2394
2395 size = roundup_pow_of_two(sizeof(*sbi->s_group_info) * size); 2395 size = roundup_pow_of_two(sizeof(*sbi->s_group_info) * size);
2396 new_groupinfo = ext4_kvzalloc(size, GFP_KERNEL); 2396 new_groupinfo = kvzalloc(size, GFP_KERNEL);
2397 if (!new_groupinfo) { 2397 if (!new_groupinfo) {
2398 ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group"); 2398 ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
2399 return -ENOMEM; 2399 return -ENOMEM;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 96973ee74147..c90edf09b0c3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2155,7 +2155,7 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
2155 return 0; 2155 return 0;
2156 2156
2157 size = roundup_pow_of_two(size * sizeof(struct flex_groups)); 2157 size = roundup_pow_of_two(size * sizeof(struct flex_groups));
2158 new_groups = ext4_kvzalloc(size, GFP_KERNEL); 2158 new_groups = kvzalloc(size, GFP_KERNEL);
2159 if (!new_groups) { 2159 if (!new_groups) {
2160 ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups", 2160 ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups",
2161 size / (int) sizeof(struct flex_groups)); 2161 size / (int) sizeof(struct flex_groups));
@@ -3889,7 +3889,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3889 goto failed_mount; 3889 goto failed_mount;
3890 } 3890 }
3891 } 3891 }
3892 sbi->s_group_desc = ext4_kvmalloc(db_count * 3892 sbi->s_group_desc = kvmalloc(db_count *
3893 sizeof(struct buffer_head *), 3893 sizeof(struct buffer_head *),
3894 GFP_KERNEL); 3894 GFP_KERNEL);
3895 if (sbi->s_group_desc == NULL) { 3895 if (sbi->s_group_desc == NULL) {
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e26999a74522..2185c7a040a1 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2071,26 +2071,6 @@ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
2071 return kmalloc(size, flags); 2071 return kmalloc(size, flags);
2072} 2072}
2073 2073
2074static inline void *f2fs_kvmalloc(size_t size, gfp_t flags)
2075{
2076 void *ret;
2077
2078 ret = kmalloc(size, flags | __GFP_NOWARN);
2079 if (!ret)
2080 ret = __vmalloc(size, flags, PAGE_KERNEL);
2081 return ret;
2082}
2083
2084static inline void *f2fs_kvzalloc(size_t size, gfp_t flags)
2085{
2086 void *ret;
2087
2088 ret = kzalloc(size, flags | __GFP_NOWARN);
2089 if (!ret)
2090 ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL);
2091 return ret;
2092}
2093
2094#define get_inode_mode(i) \ 2074#define get_inode_mode(i) \
2095 ((is_inode_flag_set(i, FI_ACL_MODE)) ? \ 2075 ((is_inode_flag_set(i, FI_ACL_MODE)) ? \
2096 (F2FS_I(i)->i_acl_mode) : ((i)->i_mode)) 2076 (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index abb0403d3414..61af721329fa 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1011,11 +1011,11 @@ static int __exchange_data_block(struct inode *src_inode,
1011 while (len) { 1011 while (len) {
1012 olen = min((pgoff_t)4 * ADDRS_PER_BLOCK, len); 1012 olen = min((pgoff_t)4 * ADDRS_PER_BLOCK, len);
1013 1013
1014 src_blkaddr = f2fs_kvzalloc(sizeof(block_t) * olen, GFP_KERNEL); 1014 src_blkaddr = kvzalloc(sizeof(block_t) * olen, GFP_KERNEL);
1015 if (!src_blkaddr) 1015 if (!src_blkaddr)
1016 return -ENOMEM; 1016 return -ENOMEM;
1017 1017
1018 do_replace = f2fs_kvzalloc(sizeof(int) * olen, GFP_KERNEL); 1018 do_replace = kvzalloc(sizeof(int) * olen, GFP_KERNEL);
1019 if (!do_replace) { 1019 if (!do_replace) {
1020 kvfree(src_blkaddr); 1020 kvfree(src_blkaddr);
1021 return -ENOMEM; 1021 return -ENOMEM;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 98351a4a4da3..4547c5c5cd98 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2652,17 +2652,17 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi)
2652{ 2652{
2653 struct f2fs_nm_info *nm_i = NM_I(sbi); 2653 struct f2fs_nm_info *nm_i = NM_I(sbi);
2654 2654
2655 nm_i->free_nid_bitmap = f2fs_kvzalloc(nm_i->nat_blocks * 2655 nm_i->free_nid_bitmap = kvzalloc(nm_i->nat_blocks *
2656 NAT_ENTRY_BITMAP_SIZE, GFP_KERNEL); 2656 NAT_ENTRY_BITMAP_SIZE, GFP_KERNEL);
2657 if (!nm_i->free_nid_bitmap) 2657 if (!nm_i->free_nid_bitmap)
2658 return -ENOMEM; 2658 return -ENOMEM;
2659 2659
2660 nm_i->nat_block_bitmap = f2fs_kvzalloc(nm_i->nat_blocks / 8, 2660 nm_i->nat_block_bitmap = kvzalloc(nm_i->nat_blocks / 8,
2661 GFP_KERNEL); 2661 GFP_KERNEL);
2662 if (!nm_i->nat_block_bitmap) 2662 if (!nm_i->nat_block_bitmap)
2663 return -ENOMEM; 2663 return -ENOMEM;
2664 2664
2665 nm_i->free_nid_count = f2fs_kvzalloc(nm_i->nat_blocks * 2665 nm_i->free_nid_count = kvzalloc(nm_i->nat_blocks *
2666 sizeof(unsigned short), GFP_KERNEL); 2666 sizeof(unsigned short), GFP_KERNEL);
2667 if (!nm_i->free_nid_count) 2667 if (!nm_i->free_nid_count)
2668 return -ENOMEM; 2668 return -ENOMEM;
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index de31030b5041..96845854e7ee 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2834,13 +2834,13 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
2834 2834
2835 SM_I(sbi)->sit_info = sit_i; 2835 SM_I(sbi)->sit_info = sit_i;
2836 2836
2837 sit_i->sentries = f2fs_kvzalloc(MAIN_SEGS(sbi) * 2837 sit_i->sentries = kvzalloc(MAIN_SEGS(sbi) *
2838 sizeof(struct seg_entry), GFP_KERNEL); 2838 sizeof(struct seg_entry), GFP_KERNEL);
2839 if (!sit_i->sentries) 2839 if (!sit_i->sentries)
2840 return -ENOMEM; 2840 return -ENOMEM;
2841 2841
2842 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi)); 2842 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
2843 sit_i->dirty_sentries_bitmap = f2fs_kvzalloc(bitmap_size, GFP_KERNEL); 2843 sit_i->dirty_sentries_bitmap = kvzalloc(bitmap_size, GFP_KERNEL);
2844 if (!sit_i->dirty_sentries_bitmap) 2844 if (!sit_i->dirty_sentries_bitmap)
2845 return -ENOMEM; 2845 return -ENOMEM;
2846 2846
@@ -2873,7 +2873,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
2873 return -ENOMEM; 2873 return -ENOMEM;
2874 2874
2875 if (sbi->segs_per_sec > 1) { 2875 if (sbi->segs_per_sec > 1) {
2876 sit_i->sec_entries = f2fs_kvzalloc(MAIN_SECS(sbi) * 2876 sit_i->sec_entries = kvzalloc(MAIN_SECS(sbi) *
2877 sizeof(struct sec_entry), GFP_KERNEL); 2877 sizeof(struct sec_entry), GFP_KERNEL);
2878 if (!sit_i->sec_entries) 2878 if (!sit_i->sec_entries)
2879 return -ENOMEM; 2879 return -ENOMEM;
@@ -2906,7 +2906,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
2906 sit_i->dirty_sentries = 0; 2906 sit_i->dirty_sentries = 0;
2907 sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK; 2907 sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK;
2908 sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time); 2908 sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time);
2909 sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec; 2909 sit_i->mounted_time = ktime_get_real_seconds();
2910 mutex_init(&sit_i->sentry_lock); 2910 mutex_init(&sit_i->sentry_lock);
2911 return 0; 2911 return 0;
2912} 2912}
@@ -2924,12 +2924,12 @@ static int build_free_segmap(struct f2fs_sb_info *sbi)
2924 SM_I(sbi)->free_info = free_i; 2924 SM_I(sbi)->free_info = free_i;
2925 2925
2926 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi)); 2926 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
2927 free_i->free_segmap = f2fs_kvmalloc(bitmap_size, GFP_KERNEL); 2927 free_i->free_segmap = kvmalloc(bitmap_size, GFP_KERNEL);
2928 if (!free_i->free_segmap) 2928 if (!free_i->free_segmap)
2929 return -ENOMEM; 2929 return -ENOMEM;
2930 2930
2931 sec_bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi)); 2931 sec_bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi));
2932 free_i->free_secmap = f2fs_kvmalloc(sec_bitmap_size, GFP_KERNEL); 2932 free_i->free_secmap = kvmalloc(sec_bitmap_size, GFP_KERNEL);
2933 if (!free_i->free_secmap) 2933 if (!free_i->free_secmap)
2934 return -ENOMEM; 2934 return -ENOMEM;
2935 2935
@@ -3109,7 +3109,7 @@ static int init_victim_secmap(struct f2fs_sb_info *sbi)
3109 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); 3109 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
3110 unsigned int bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi)); 3110 unsigned int bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi));
3111 3111
3112 dirty_i->victim_secmap = f2fs_kvzalloc(bitmap_size, GFP_KERNEL); 3112 dirty_i->victim_secmap = kvzalloc(bitmap_size, GFP_KERNEL);
3113 if (!dirty_i->victim_secmap) 3113 if (!dirty_i->victim_secmap)
3114 return -ENOMEM; 3114 return -ENOMEM;
3115 return 0; 3115 return 0;
@@ -3131,7 +3131,7 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi)
3131 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi)); 3131 bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
3132 3132
3133 for (i = 0; i < NR_DIRTY_TYPE; i++) { 3133 for (i = 0; i < NR_DIRTY_TYPE; i++) {
3134 dirty_i->dirty_segmap[i] = f2fs_kvzalloc(bitmap_size, GFP_KERNEL); 3134 dirty_i->dirty_segmap[i] = kvzalloc(bitmap_size, GFP_KERNEL);
3135 if (!dirty_i->dirty_segmap[i]) 3135 if (!dirty_i->dirty_segmap[i])
3136 return -ENOMEM; 3136 return -ENOMEM;
3137 } 3137 }
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 10bf05d4cff4..010f336a7573 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -712,8 +712,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start)
712static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi) 712static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi)
713{ 713{
714 struct sit_info *sit_i = SIT_I(sbi); 714 struct sit_info *sit_i = SIT_I(sbi);
715 return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec - 715 time64_t now = ktime_get_real_seconds();
716 sit_i->mounted_time; 716
717 return sit_i->elapsed_time + now - sit_i->mounted_time;
717} 718}
718 719
719static inline void set_summary(struct f2fs_summary *sum, nid_t nid, 720static inline void set_summary(struct f2fs_summary *sum, nid_t nid,
diff --git a/fs/file.c b/fs/file.c
index ad6f094f2eff..1c2972e3a405 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -42,7 +42,7 @@ static void *alloc_fdmem(size_t size)
42 if (data != NULL) 42 if (data != NULL)
43 return data; 43 return data;
44 } 44 }
45 return __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM, PAGE_KERNEL); 45 return __vmalloc(size, GFP_KERNEL_ACCOUNT, PAGE_KERNEL);
46} 46}
47 47
48static void __free_fdtable(struct fdtable *fdt) 48static void __free_fdtable(struct fdtable *fdt)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 3814a60e0aea..4d810be532dd 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1072,7 +1072,7 @@ out_unlock:
1072 /* Every transaction boundary, we rewrite the dinode 1072 /* Every transaction boundary, we rewrite the dinode
1073 to keep its di_blocks current in case of failure. */ 1073 to keep its di_blocks current in case of failure. */
1074 ip->i_inode.i_mtime = ip->i_inode.i_ctime = 1074 ip->i_inode.i_mtime = ip->i_inode.i_ctime =
1075 CURRENT_TIME; 1075 current_time(&ip->i_inode);
1076 gfs2_trans_add_meta(ip->i_gl, dibh); 1076 gfs2_trans_add_meta(ip->i_gl, dibh);
1077 gfs2_dinode_out(ip, dibh->b_data); 1077 gfs2_dinode_out(ip, dibh->b_data);
1078 up_write(&ip->i_rw_mutex); 1078 up_write(&ip->i_rw_mutex);
@@ -1293,7 +1293,7 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 newsize)
1293 gfs2_statfs_change(sdp, 0, +btotal, 0); 1293 gfs2_statfs_change(sdp, 0, +btotal, 0);
1294 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, 1294 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
1295 ip->i_inode.i_gid); 1295 ip->i_inode.i_gid);
1296 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1296 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
1297 gfs2_trans_add_meta(ip->i_gl, dibh); 1297 gfs2_trans_add_meta(ip->i_gl, dibh);
1298 gfs2_dinode_out(ip, dibh->b_data); 1298 gfs2_dinode_out(ip, dibh->b_data);
1299 up_write(&ip->i_rw_mutex); 1299 up_write(&ip->i_rw_mutex);
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index e33a0d36a93e..5d0182654580 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -485,8 +485,8 @@ void hfs_file_truncate(struct inode *inode)
485 485
486 /* XXX: Can use generic_cont_expand? */ 486 /* XXX: Can use generic_cont_expand? */
487 size = inode->i_size - 1; 487 size = inode->i_size - 1;
488 res = pagecache_write_begin(NULL, mapping, size+1, 0, 488 res = pagecache_write_begin(NULL, mapping, size+1, 0, 0,
489 AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); 489 &page, &fsdata);
490 if (!res) { 490 if (!res) {
491 res = pagecache_write_end(NULL, mapping, size+1, 0, 0, 491 res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
492 page, fsdata); 492 page, fsdata);
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index feca524ce2a5..a3eb640b4f8f 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -545,9 +545,8 @@ void hfsplus_file_truncate(struct inode *inode)
545 void *fsdata; 545 void *fsdata;
546 loff_t size = inode->i_size; 546 loff_t size = inode->i_size;
547 547
548 res = pagecache_write_begin(NULL, mapping, size, 0, 548 res = pagecache_write_begin(NULL, mapping, size, 0, 0,
549 AOP_FLAG_UNINTERRUPTIBLE, 549 &page, &fsdata);
550 &page, &fsdata);
551 if (res) 550 if (res)
552 return; 551 return;
553 res = pagecache_write_end(NULL, mapping, size, 552 res = pagecache_write_end(NULL, mapping, size,
diff --git a/fs/inode.c b/fs/inode.c
index 131b2bcebc48..6ad1edb52045 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -119,7 +119,7 @@ static int no_open(struct inode *inode, struct file *file)
119} 119}
120 120
121/** 121/**
122 * inode_init_always - perform inode structure intialisation 122 * inode_init_always - perform inode structure initialisation
123 * @sb: superblock inode belongs to 123 * @sb: superblock inode belongs to
124 * @inode: inode to initialise 124 * @inode: inode to initialise
125 * 125 *
diff --git a/fs/iomap.c b/fs/iomap.c
index 1faabe09b8fd..4b10892967a5 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -158,12 +158,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
158 ssize_t written = 0; 158 ssize_t written = 0;
159 unsigned int flags = AOP_FLAG_NOFS; 159 unsigned int flags = AOP_FLAG_NOFS;
160 160
161 /*
162 * Copies from kernel address space cannot fail (NFSD is a big user).
163 */
164 if (!iter_is_iovec(i))
165 flags |= AOP_FLAG_UNINTERRUPTIBLE;
166
167 do { 161 do {
168 struct page *page; 162 struct page *page;
169 unsigned long offset; /* Offset into pagecache page */ 163 unsigned long offset; /* Offset into pagecache page */
@@ -291,8 +285,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
291 return PTR_ERR(rpage); 285 return PTR_ERR(rpage);
292 286
293 status = iomap_write_begin(inode, pos, bytes, 287 status = iomap_write_begin(inode, pos, bytes,
294 AOP_FLAG_NOFS | AOP_FLAG_UNINTERRUPTIBLE, 288 AOP_FLAG_NOFS, &page, iomap);
295 &page, iomap);
296 put_page(rpage); 289 put_page(rpage);
297 if (unlikely(status)) 290 if (unlikely(status))
298 return status; 291 return status;
@@ -343,8 +336,8 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,
343 struct page *page; 336 struct page *page;
344 int status; 337 int status;
345 338
346 status = iomap_write_begin(inode, pos, bytes, 339 status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS, &page,
347 AOP_FLAG_UNINTERRUPTIBLE | AOP_FLAG_NOFS, &page, iomap); 340 iomap);
348 if (status) 341 if (status)
349 return status; 342 return status;
350 343
diff --git a/fs/namei.c b/fs/namei.c
index 9a7f8bd748d8..7286f87ce863 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4766,7 +4766,7 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
4766 struct page *page; 4766 struct page *page;
4767 void *fsdata; 4767 void *fsdata;
4768 int err; 4768 int err;
4769 unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE; 4769 unsigned int flags = 0;
4770 if (nofs) 4770 if (nofs)
4771 flags |= AOP_FLAG_NOFS; 4771 flags |= AOP_FLAG_NOFS;
4772 4772
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 323f492e0822..f3db56e83dd2 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -196,9 +196,11 @@ int ns_get_name(char *buf, size_t size, struct task_struct *task,
196{ 196{
197 struct ns_common *ns; 197 struct ns_common *ns;
198 int res = -ENOENT; 198 int res = -ENOENT;
199 const char *name;
199 ns = ns_ops->get(task); 200 ns = ns_ops->get(task);
200 if (ns) { 201 if (ns) {
201 res = snprintf(buf, size, "%s:[%u]", ns_ops->name, ns->inum); 202 name = ns_ops->real_ns_name ? : ns_ops->name;
203 res = snprintf(buf, size, "%s:[%u]", name, ns->inum);
202 ns_ops->put(ns); 204 ns_ops->put(ns);
203 } 205 }
204 return res; 206 return res;
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 2cc7a8030275..e250910cffc8 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -58,7 +58,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
58 struct proc_inode *ei; 58 struct proc_inode *ei;
59 struct inode *inode; 59 struct inode *inode;
60 60
61 ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL); 61 ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
62 if (!ei) 62 if (!ei)
63 return NULL; 63 return NULL;
64 ei->pid = NULL; 64 ei->pid = NULL;
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 766f0c637ad1..3803b24ca220 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -23,6 +23,7 @@ static const struct proc_ns_operations *ns_entries[] = {
23#endif 23#endif
24#ifdef CONFIG_PID_NS 24#ifdef CONFIG_PID_NS
25 &pidns_operations, 25 &pidns_operations,
26 &pidns_for_children_operations,
26#endif 27#endif
27#ifdef CONFIG_USER_NS 28#ifdef CONFIG_USER_NS
28 &userns_operations, 29 &userns_operations,
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index aca73dd73906..e3c558d1b78c 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi)
724} 724}
725 725
726static struct item_operations errcatch_ops = { 726static struct item_operations errcatch_ops = {
727 errcatch_bytes_number, 727 .bytes_number = errcatch_bytes_number,
728 errcatch_decrement_key, 728 .decrement_key = errcatch_decrement_key,
729 errcatch_is_left_mergeable, 729 .is_left_mergeable = errcatch_is_left_mergeable,
730 errcatch_print_item, 730 .print_item = errcatch_print_item,
731 errcatch_check_item, 731 .check_item = errcatch_check_item,
732 732
733 errcatch_create_vi, 733 .create_vi = errcatch_create_vi,
734 errcatch_check_left, 734 .check_left = errcatch_check_left,
735 errcatch_check_right, 735 .check_right = errcatch_check_right,
736 errcatch_part_size, 736 .part_size = errcatch_part_size,
737 errcatch_unit_num, 737 .unit_num = errcatch_unit_num,
738 errcatch_print_vi 738 .print_vi = errcatch_print_vi
739}; 739};
740 740
741#if ! (TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3) 741#if ! (TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3)
diff --git a/fs/select.c b/fs/select.c
index bd4b2ccfd346..d6c652a31e99 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -633,10 +633,7 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
633 goto out_nofds; 633 goto out_nofds;
634 634
635 alloc_size = 6 * size; 635 alloc_size = 6 * size;
636 bits = kmalloc(alloc_size, GFP_KERNEL|__GFP_NOWARN); 636 bits = kvmalloc(alloc_size, GFP_KERNEL);
637 if (!bits && alloc_size > PAGE_SIZE)
638 bits = vmalloc(alloc_size);
639
640 if (!bits) 637 if (!bits)
641 goto out_nofds; 638 goto out_nofds;
642 } 639 }
diff --git a/fs/seq_file.c b/fs/seq_file.c
index ca69fb99e41a..dc7c2be963ed 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -25,21 +25,7 @@ static void seq_set_overflow(struct seq_file *m)
25 25
26static void *seq_buf_alloc(unsigned long size) 26static void *seq_buf_alloc(unsigned long size)
27{ 27{
28 void *buf; 28 return kvmalloc(size, GFP_KERNEL);
29 gfp_t gfp = GFP_KERNEL;
30
31 /*
32 * For high order allocations, use __GFP_NORETRY to avoid oom-killing -
33 * it's better to fall back to vmalloc() than to kill things. For small
34 * allocations, just use GFP_KERNEL which will oom kill, thus no need
35 * for vmalloc fallback.
36 */
37 if (size > PAGE_SIZE)
38 gfp |= __GFP_NORETRY | __GFP_NOWARN;
39 buf = kmalloc(size, gfp);
40 if (!buf && size > PAGE_SIZE)
41 buf = vmalloc(size);
42 return buf;
43} 29}
44 30
45/** 31/**
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 8049851cac42..566079d9b402 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -121,7 +121,7 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
121 121
122 inode_init_owner(inode, dir, mode); 122 inode_init_owner(inode, dir, mode);
123 inode->i_mtime = inode->i_atime = inode->i_ctime = 123 inode->i_mtime = inode->i_atime = inode->i_ctime =
124 ubifs_current_time(inode); 124 current_time(inode);
125 inode->i_mapping->nrpages = 0; 125 inode->i_mapping->nrpages = 0;
126 126
127 switch (mode & S_IFMT) { 127 switch (mode & S_IFMT) {
@@ -766,7 +766,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
766 766
767 inc_nlink(inode); 767 inc_nlink(inode);
768 ihold(inode); 768 ihold(inode);
769 inode->i_ctime = ubifs_current_time(inode); 769 inode->i_ctime = current_time(inode);
770 dir->i_size += sz_change; 770 dir->i_size += sz_change;
771 dir_ui->ui_size = dir->i_size; 771 dir_ui->ui_size = dir->i_size;
772 dir->i_mtime = dir->i_ctime = inode->i_ctime; 772 dir->i_mtime = dir->i_ctime = inode->i_ctime;
@@ -841,7 +841,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
841 } 841 }
842 842
843 lock_2_inodes(dir, inode); 843 lock_2_inodes(dir, inode);
844 inode->i_ctime = ubifs_current_time(dir); 844 inode->i_ctime = current_time(dir);
845 drop_nlink(inode); 845 drop_nlink(inode);
846 dir->i_size -= sz_change; 846 dir->i_size -= sz_change;
847 dir_ui->ui_size = dir->i_size; 847 dir_ui->ui_size = dir->i_size;
@@ -945,7 +945,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
945 } 945 }
946 946
947 lock_2_inodes(dir, inode); 947 lock_2_inodes(dir, inode);
948 inode->i_ctime = ubifs_current_time(dir); 948 inode->i_ctime = current_time(dir);
949 clear_nlink(inode); 949 clear_nlink(inode);
950 drop_nlink(dir); 950 drop_nlink(dir);
951 dir->i_size -= sz_change; 951 dir->i_size -= sz_change;
@@ -1422,7 +1422,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
1422 * Like most other Unix systems, set the @i_ctime for inodes on a 1422 * Like most other Unix systems, set the @i_ctime for inodes on a
1423 * rename. 1423 * rename.
1424 */ 1424 */
1425 time = ubifs_current_time(old_dir); 1425 time = current_time(old_dir);
1426 old_inode->i_ctime = time; 1426 old_inode->i_ctime = time;
1427 1427
1428 /* We must adjust parent link count when renaming directories */ 1428 /* We must adjust parent link count when renaming directories */
@@ -1595,7 +1595,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
1595 1595
1596 lock_4_inodes(old_dir, new_dir, NULL, NULL); 1596 lock_4_inodes(old_dir, new_dir, NULL, NULL);
1597 1597
1598 time = ubifs_current_time(old_dir); 1598 time = current_time(old_dir);
1599 fst_inode->i_ctime = time; 1599 fst_inode->i_ctime = time;
1600 snd_inode->i_ctime = time; 1600 snd_inode->i_ctime = time;
1601 old_dir->i_mtime = old_dir->i_ctime = time; 1601 old_dir->i_mtime = old_dir->i_ctime = time;
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index d9ae86f96df7..2cda3d67e2d0 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1196,7 +1196,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
1196 mutex_lock(&ui->ui_mutex); 1196 mutex_lock(&ui->ui_mutex);
1197 ui->ui_size = inode->i_size; 1197 ui->ui_size = inode->i_size;
1198 /* Truncation changes inode [mc]time */ 1198 /* Truncation changes inode [mc]time */
1199 inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); 1199 inode->i_mtime = inode->i_ctime = current_time(inode);
1200 /* Other attributes may be changed at the same time as well */ 1200 /* Other attributes may be changed at the same time as well */
1201 do_attr_changes(inode, attr); 1201 do_attr_changes(inode, attr);
1202 err = ubifs_jnl_truncate(c, inode, old_size, new_size); 1202 err = ubifs_jnl_truncate(c, inode, old_size, new_size);
@@ -1243,7 +1243,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1243 mutex_lock(&ui->ui_mutex); 1243 mutex_lock(&ui->ui_mutex);
1244 if (attr->ia_valid & ATTR_SIZE) { 1244 if (attr->ia_valid & ATTR_SIZE) {
1245 /* Truncation changes inode [mc]time */ 1245 /* Truncation changes inode [mc]time */
1246 inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); 1246 inode->i_mtime = inode->i_ctime = current_time(inode);
1247 /* 'truncate_setsize()' changed @i_size, update @ui_size */ 1247 /* 'truncate_setsize()' changed @i_size, update @ui_size */
1248 ui->ui_size = inode->i_size; 1248 ui->ui_size = inode->i_size;
1249 } 1249 }
@@ -1420,7 +1420,7 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
1420 */ 1420 */
1421static int update_mctime(struct inode *inode) 1421static int update_mctime(struct inode *inode)
1422{ 1422{
1423 struct timespec now = ubifs_current_time(inode); 1423 struct timespec now = current_time(inode);
1424 struct ubifs_inode *ui = ubifs_inode(inode); 1424 struct ubifs_inode *ui = ubifs_inode(inode);
1425 struct ubifs_info *c = inode->i_sb->s_fs_info; 1425 struct ubifs_info *c = inode->i_sb->s_fs_info;
1426 1426
@@ -1434,7 +1434,7 @@ static int update_mctime(struct inode *inode)
1434 return err; 1434 return err;
1435 1435
1436 mutex_lock(&ui->ui_mutex); 1436 mutex_lock(&ui->ui_mutex);
1437 inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); 1437 inode->i_mtime = inode->i_ctime = current_time(inode);
1438 release = ui->dirty; 1438 release = ui->dirty;
1439 mark_inode_dirty_sync(inode); 1439 mark_inode_dirty_sync(inode);
1440 mutex_unlock(&ui->ui_mutex); 1440 mutex_unlock(&ui->ui_mutex);
@@ -1511,7 +1511,7 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
1511 struct page *page = vmf->page; 1511 struct page *page = vmf->page;
1512 struct inode *inode = file_inode(vmf->vma->vm_file); 1512 struct inode *inode = file_inode(vmf->vma->vm_file);
1513 struct ubifs_info *c = inode->i_sb->s_fs_info; 1513 struct ubifs_info *c = inode->i_sb->s_fs_info;
1514 struct timespec now = ubifs_current_time(inode); 1514 struct timespec now = current_time(inode);
1515 struct ubifs_budget_req req = { .new_page = 1 }; 1515 struct ubifs_budget_req req = { .new_page = 1 };
1516 int err, update_time; 1516 int err, update_time;
1517 1517
@@ -1579,7 +1579,7 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
1579 struct ubifs_inode *ui = ubifs_inode(inode); 1579 struct ubifs_inode *ui = ubifs_inode(inode);
1580 1580
1581 mutex_lock(&ui->ui_mutex); 1581 mutex_lock(&ui->ui_mutex);
1582 inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); 1582 inode->i_mtime = inode->i_ctime = current_time(inode);
1583 release = ui->dirty; 1583 release = ui->dirty;
1584 mark_inode_dirty_sync(inode); 1584 mark_inode_dirty_sync(inode);
1585 mutex_unlock(&ui->ui_mutex); 1585 mutex_unlock(&ui->ui_mutex);
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index da519ba205f6..12b9eb5005ff 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -126,7 +126,7 @@ static int setflags(struct inode *inode, int flags)
126 126
127 ui->flags = ioctl2ubifs(flags); 127 ui->flags = ioctl2ubifs(flags);
128 ubifs_set_inode_flags(inode); 128 ubifs_set_inode_flags(inode);
129 inode->i_ctime = ubifs_current_time(inode); 129 inode->i_ctime = current_time(inode);
130 release = ui->dirty; 130 release = ui->dirty;
131 mark_inode_dirty_sync(inode); 131 mark_inode_dirty_sync(inode);
132 mutex_unlock(&ui->ui_mutex); 132 mutex_unlock(&ui->ui_mutex);
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index 8ece6ca58c0b..caf83d68fb38 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -225,16 +225,6 @@ static inline void *ubifs_idx_key(const struct ubifs_info *c,
225} 225}
226 226
227/** 227/**
228 * ubifs_current_time - round current time to time granularity.
229 * @inode: inode
230 */
231static inline struct timespec ubifs_current_time(struct inode *inode)
232{
233 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
234 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
235}
236
237/**
238 * ubifs_tnc_lookup - look up a file-system node. 228 * ubifs_tnc_lookup - look up a file-system node.
239 * @c: UBIFS file-system description object 229 * @c: UBIFS file-system description object
240 * @key: node key to lookup 230 * @key: node key to lookup
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 7f1ead29e727..8c25081a5109 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -84,6 +84,8 @@ static int create_default_filesystem(struct ubifs_info *c)
84 int min_leb_cnt = UBIFS_MIN_LEB_CNT; 84 int min_leb_cnt = UBIFS_MIN_LEB_CNT;
85 long long tmp64, main_bytes; 85 long long tmp64, main_bytes;
86 __le64 tmp_le64; 86 __le64 tmp_le64;
87 __le32 tmp_le32;
88 struct timespec ts;
87 89
88 /* Some functions called from here depend on the @c->key_len filed */ 90 /* Some functions called from here depend on the @c->key_len filed */
89 c->key_len = UBIFS_SK_LEN; 91 c->key_len = UBIFS_SK_LEN;
@@ -298,13 +300,17 @@ static int create_default_filesystem(struct ubifs_info *c)
298 ino->ch.node_type = UBIFS_INO_NODE; 300 ino->ch.node_type = UBIFS_INO_NODE;
299 ino->creat_sqnum = cpu_to_le64(++c->max_sqnum); 301 ino->creat_sqnum = cpu_to_le64(++c->max_sqnum);
300 ino->nlink = cpu_to_le32(2); 302 ino->nlink = cpu_to_le32(2);
301 tmp_le64 = cpu_to_le64(CURRENT_TIME_SEC.tv_sec); 303
304 ktime_get_real_ts(&ts);
305 ts = timespec_trunc(ts, DEFAULT_TIME_GRAN);
306 tmp_le64 = cpu_to_le64(ts.tv_sec);
302 ino->atime_sec = tmp_le64; 307 ino->atime_sec = tmp_le64;
303 ino->ctime_sec = tmp_le64; 308 ino->ctime_sec = tmp_le64;
304 ino->mtime_sec = tmp_le64; 309 ino->mtime_sec = tmp_le64;
305 ino->atime_nsec = 0; 310 tmp_le32 = cpu_to_le32(ts.tv_nsec);
306 ino->ctime_nsec = 0; 311 ino->atime_nsec = tmp_le32;
307 ino->mtime_nsec = 0; 312 ino->ctime_nsec = tmp_le32;
313 ino->mtime_nsec = tmp_le32;
308 ino->mode = cpu_to_le32(S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO); 314 ino->mode = cpu_to_le32(S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO);
309 ino->size = cpu_to_le64(UBIFS_INO_NODE_SZ); 315 ino->size = cpu_to_le64(UBIFS_INO_NODE_SZ);
310 316
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index efe00fcb8b75..3e53fdbf7997 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -152,7 +152,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
152 ui->data_len = size; 152 ui->data_len = size;
153 153
154 mutex_lock(&host_ui->ui_mutex); 154 mutex_lock(&host_ui->ui_mutex);
155 host->i_ctime = ubifs_current_time(host); 155 host->i_ctime = current_time(host);
156 host_ui->xattr_cnt += 1; 156 host_ui->xattr_cnt += 1;
157 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); 157 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
158 host_ui->xattr_size += CALC_XATTR_BYTES(size); 158 host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -234,7 +234,7 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
234 mutex_unlock(&ui->ui_mutex); 234 mutex_unlock(&ui->ui_mutex);
235 235
236 mutex_lock(&host_ui->ui_mutex); 236 mutex_lock(&host_ui->ui_mutex);
237 host->i_ctime = ubifs_current_time(host); 237 host->i_ctime = current_time(host);
238 host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); 238 host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
239 host_ui->xattr_size += CALC_XATTR_BYTES(size); 239 host_ui->xattr_size += CALC_XATTR_BYTES(size);
240 240
@@ -488,7 +488,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
488 return err; 488 return err;
489 489
490 mutex_lock(&host_ui->ui_mutex); 490 mutex_lock(&host_ui->ui_mutex);
491 host->i_ctime = ubifs_current_time(host); 491 host->i_ctime = current_time(host);
492 host_ui->xattr_cnt -= 1; 492 host_ui->xattr_cnt -= 1;
493 host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); 493 host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
494 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len); 494 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 9774555b3721..d1dd8cc33179 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -176,6 +176,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
176 struct ufs_cg_private_info * ucpi; 176 struct ufs_cg_private_info * ucpi;
177 struct ufs_cylinder_group * ucg; 177 struct ufs_cylinder_group * ucg;
178 struct inode * inode; 178 struct inode * inode;
179 struct timespec64 ts;
179 unsigned cg, bit, i, j, start; 180 unsigned cg, bit, i, j, start;
180 struct ufs_inode_info *ufsi; 181 struct ufs_inode_info *ufsi;
181 int err = -ENOSPC; 182 int err = -ENOSPC;
@@ -323,8 +324,9 @@ cg_found:
323 lock_buffer(bh); 324 lock_buffer(bh);
324 ufs2_inode = (struct ufs2_inode *)bh->b_data; 325 ufs2_inode = (struct ufs2_inode *)bh->b_data;
325 ufs2_inode += ufs_inotofsbo(inode->i_ino); 326 ufs2_inode += ufs_inotofsbo(inode->i_ino);
326 ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec); 327 ktime_get_real_ts64(&ts);
327 ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec); 328 ufs2_inode->ui_birthtime = cpu_to_fs64(sb, ts.tv_sec);
329 ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, ts.tv_nsec);
328 mark_buffer_dirty(bh); 330 mark_buffer_dirty(bh);
329 unlock_buffer(bh); 331 unlock_buffer(bh);
330 if (sb->s_flags & MS_SYNCHRONOUS) 332 if (sb->s_flags & MS_SYNCHRONOUS)
diff --git a/fs/xattr.c b/fs/xattr.c
index 7e3317cf4045..464c94bf65f9 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -431,12 +431,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
431 if (size) { 431 if (size) {
432 if (size > XATTR_SIZE_MAX) 432 if (size > XATTR_SIZE_MAX)
433 return -E2BIG; 433 return -E2BIG;
434 kvalue = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); 434 kvalue = kvmalloc(size, GFP_KERNEL);
435 if (!kvalue) { 435 if (!kvalue)
436 kvalue = vmalloc(size); 436 return -ENOMEM;
437 if (!kvalue)
438 return -ENOMEM;
439 }
440 if (copy_from_user(kvalue, value, size)) { 437 if (copy_from_user(kvalue, value, size)) {
441 error = -EFAULT; 438 error = -EFAULT;
442 goto out; 439 goto out;
@@ -528,12 +525,9 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
528 if (size) { 525 if (size) {
529 if (size > XATTR_SIZE_MAX) 526 if (size > XATTR_SIZE_MAX)
530 size = XATTR_SIZE_MAX; 527 size = XATTR_SIZE_MAX;
531 kvalue = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); 528 kvalue = kvzalloc(size, GFP_KERNEL);
532 if (!kvalue) { 529 if (!kvalue)
533 kvalue = vmalloc(size); 530 return -ENOMEM;
534 if (!kvalue)
535 return -ENOMEM;
536 }
537 } 531 }
538 532
539 error = vfs_getxattr(d, kname, kvalue, size); 533 error = vfs_getxattr(d, kname, kvalue, size);
@@ -611,12 +605,9 @@ listxattr(struct dentry *d, char __user *list, size_t size)
611 if (size) { 605 if (size) {
612 if (size > XATTR_LIST_MAX) 606 if (size > XATTR_LIST_MAX)
613 size = XATTR_LIST_MAX; 607 size = XATTR_LIST_MAX;
614 klist = kmalloc(size, __GFP_NOWARN | GFP_KERNEL); 608 klist = kvmalloc(size, GFP_KERNEL);
615 if (!klist) { 609 if (!klist)
616 klist = vmalloc(size); 610 return -ENOMEM;
617 if (!klist)
618 return -ENOMEM;
619 }
620 } 611 }
621 612
622 error = vfs_listxattr(d, klist, size); 613 error = vfs_listxattr(d, klist, size);
diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
index 780fc8986dab..393b6849aeb3 100644
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -67,7 +67,7 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags)
67 nofs_flag = memalloc_nofs_save(); 67 nofs_flag = memalloc_nofs_save();
68 68
69 lflags = kmem_flags_convert(flags); 69 lflags = kmem_flags_convert(flags);
70 ptr = __vmalloc(size, lflags | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); 70 ptr = __vmalloc(size, lflags | __GFP_ZERO, PAGE_KERNEL);
71 71
72 if (flags & KM_NOFS) 72 if (flags & KM_NOFS)
73 memalloc_nofs_restore(nofs_flag); 73 memalloc_nofs_restore(nofs_flag);
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4a98762ec8b4..cd0b077deb35 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3796,7 +3796,7 @@ xlog_recover_bud_pass2(
3796 * This routine is called when an inode create format structure is found in a 3796 * This routine is called when an inode create format structure is found in a
3797 * committed transaction in the log. It's purpose is to initialise the inodes 3797 * committed transaction in the log. It's purpose is to initialise the inodes
3798 * being allocated on disk. This requires us to get inode cluster buffers that 3798 * being allocated on disk. This requires us to get inode cluster buffers that
3799 * match the range to be intialised, stamped with inode templates and written 3799 * match the range to be initialised, stamped with inode templates and written
3800 * by delayed write so that subsequent modifications will hit the cached buffer 3800 * by delayed write so that subsequent modifications will hit the cached buffer
3801 * and only need writing out at the end of recovery. 3801 * and only need writing out at the end of recovery.
3802 */ 3802 */