From 31c49eac780b3bcd1e34d71c2f5c79527b26e86c Mon Sep 17 00:00:00 2001 From: Souptick Joarder Date: Sun, 15 Apr 2018 01:48:59 +0530 Subject: fs: ubifs: Adding new return type vm_fault_t Use new return type vm_fault_t for page_mkwrite handler. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox Signed-off-by: Richard Weinberger --- fs/ubifs/file.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 1acb2ff505e6..28b80713a163 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1513,7 +1513,7 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) * mmap()d file has taken write protection fault and is being made writable. * UBIFS must ensure page is budgeted for. */ -static int ubifs_vm_page_mkwrite(struct vm_fault *vmf) +static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf) { struct page *page = vmf->page; struct inode *inode = file_inode(vmf->vma->vm_file); @@ -1567,8 +1567,7 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf) if (unlikely(page->mapping != inode->i_mapping || page_offset(page) > i_size_read(inode))) { /* Page got truncated out from underneath us */ - err = -EINVAL; - goto out_unlock; + goto sigbus; } if (PagePrivate(page)) @@ -1597,12 +1596,10 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf) wait_for_stable_page(page); return VM_FAULT_LOCKED; -out_unlock: +sigbus: unlock_page(page); ubifs_release_budget(c, &req); - if (err) - err = VM_FAULT_SIGBUS; - return err; + return VM_FAULT_SIGBUS; } static const struct vm_operations_struct ubifs_file_vm_ops = { -- cgit v1.2.3 From 422edacec0927b091ea5c32384f9d5b89efec1c1 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Fri, 11 May 2018 11:26:03 +0900 Subject: ubifs, xattr: remove misguided quota flags Originally, Yang Dongsheng added quota support for ubifs, but it turned out upstream won't accept it. Since ubifs don't touch any quota code, S_NOQUOTA flag is misguided here, and currently it is mainly used to avoid recursion for system quota files. Let's make things clearly and remove unnecessary and misguied quota flags here. Reported-by: Rock Lee Signed-off-by: Wang Shilong Signed-off-by: Richard Weinberger --- fs/ubifs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 759f1a209dbb..6f720fdf5020 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -139,7 +139,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, inode->i_op = &empty_iops; inode->i_fop = &empty_fops; - inode->i_flags |= S_SYNC | S_NOATIME | S_NOCMTIME | S_NOQUOTA; + inode->i_flags |= S_SYNC | S_NOATIME | S_NOCMTIME; ui = ubifs_inode(inode); ui->xattr = 1; ui->flags |= UBIFS_XATTR_FL; -- cgit v1.2.3 From c971dad849bd71930738c2bd1d0691b730fa2ae7 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:14 +0200 Subject: ubifs: remove set but never used variable replay_sqnum is set but never used. Remove it. Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/replay.c | 3 --- fs/ubifs/ubifs.h | 2 -- 2 files changed, 5 deletions(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index ae5c02f22f3e..f10a72a75ed7 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c @@ -223,9 +223,6 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) dbg_mntk(&r->key, "LEB %d:%d len %d deletion %d sqnum %llu key ", r->lnum, r->offs, r->len, r->deletion, r->sqnum); - /* Set c->replay_sqnum to help deal with dangling branches. */ - c->replay_sqnum = r->sqnum; - if (is_hash_key(c, &r->key)) { if (r->deletion) err = ubifs_tnc_remove_nm(c, &r->key, &r->nm); diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 5ee7af879cc4..209d6369ae71 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -1206,7 +1206,6 @@ struct ubifs_debug_info; * @replay_list: temporary list used during journal replay * @replay_buds: list of buds to replay * @cs_sqnum: sequence number of first node in the log (commit start node) - * @replay_sqnum: sequence number of node currently being replayed * @unclean_leb_list: LEBs to recover when re-mounting R/O mounted FS to R/W * mode * @rcvrd_mst_node: recovered master node to write when re-mounting R/O mounted @@ -1438,7 +1437,6 @@ struct ubifs_info { struct list_head replay_list; struct list_head replay_buds; unsigned long long cs_sqnum; - unsigned long long replay_sqnum; struct list_head unclean_leb_list; struct ubifs_mst_node *rcvrd_mst_node; struct rb_root size_tree; -- cgit v1.2.3 From 671b9b75f6011e92f77d4eb2c6298bf227867699 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:15 +0200 Subject: ubifs: journal: Remove wrong comment In the description of reserve_space() it is claimed that write_node() and write_head() unlock the journal head. This is not true and has never been true. All callers of write_node() and write_head() call release_head() themselves. Remove the wrong comment. Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/journal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 04c4ec6483e5..da8afdfccaa6 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -98,9 +98,8 @@ static inline void zero_trun_node_unused(struct ubifs_trun_node *trun) * * This function reserves space in journal head @head. If the reservation * succeeded, the journal head stays locked and later has to be unlocked using - * 'release_head()'. 'write_node()' and 'write_head()' functions also unlock - * it. Returns zero in case of success, %-EAGAIN if commit has to be done, and - * other negative error codes in case of other failures. + * 'release_head()'. Returns zero in case of success, %-EAGAIN if commit has to + * be done, and other negative error codes in case of other failures. */ static int reserve_space(struct ubifs_info *c, int jhead, int len) { -- cgit v1.2.3 From c7e593b3bdf36ab8a4fe48551367e446fe0c290c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:16 +0200 Subject: ubifs: Spelling fix someting -> something Replace "someting" with "something" Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/replay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index f10a72a75ed7..85c2a43082b7 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c @@ -1034,7 +1034,7 @@ int ubifs_replay_journal(struct ubifs_info *c) * The head of the log must always start with the * "commit start" node on a properly formatted UBIFS. * But we found no nodes at all, which means that - * someting went wrong and we cannot proceed mounting + * something went wrong and we cannot proceed mounting * the file-system. */ ubifs_err(c, "no UBIFS nodes found at the log head LEB %d:%d, possibly corrupted", -- cgit v1.2.3 From 71d561f0264126a6a6fc5e209cf159ce2d355846 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:17 +0200 Subject: ubifs: log: Some spelling fixes - add missing article - remove misplaced 'it' - s/tress/trees Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 8c795e6392b1..7cffa120a750 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c @@ -167,10 +167,10 @@ void ubifs_add_bud(struct ubifs_info *c, struct ubifs_bud *bud) * @lnum: LEB number of the bud * @offs: starting offset of the bud * - * This function writes reference node for the new bud LEB @lnum it to the log, - * and adds it to the buds tress. It also makes sure that log size does not + * This function writes a reference node for the new bud LEB @lnum to the log, + * and adds it to the buds trees. It also makes sure that log size does not * exceed the 'c->max_bud_bytes' limit. Returns zero in case of success, - * %-EAGAIN if commit is required, and a negative error codes in case of + * %-EAGAIN if commit is required, and a negative error code in case of * failure. */ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) -- cgit v1.2.3 From 28e5dfd84239f1ce332a39cb1055d5debf611303 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:18 +0200 Subject: ubifs: gc: Fix typo "point of view" makes more sense than "point of few". Fix this. Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 7b35e3d6cde7..a03a47cf880d 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -49,7 +49,7 @@ * maximum size. So dark watermark is the amount of free + dirty space in LEB * which are guaranteed to be reclaimable. If LEB has less space, the GC might * be unable to reclaim it. So, LEBs with free + dirty greater than dark - * watermark are "good" LEBs from GC's point of few. The other LEBs are not so + * watermark are "good" LEBs from GC's point of view. The other LEBs are not so * good, and GC takes extra care when moving them. */ -- cgit v1.2.3 From e1db654d8e326173a1c1a0194185250340cab03c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 14 May 2018 10:18:19 +0200 Subject: ubifs: lpt: Fix wrong pnode number range in comment The comment above pnode_lookup claims the range for the pnode number is from 0 to main_lebs - 1. This is wrong because every pnode has informations about UBIFS_LPT_FANOUT LEBs, thus the corrent range is 0 to to (main_lebs - 1) / UBIFS_LPT_FANOUT. Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger --- fs/ubifs/lpt_commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/ubifs') diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 235654c2fe89..78da65b2fb85 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -619,7 +619,7 @@ static struct ubifs_pnode *next_pnode_to_dirty(struct ubifs_info *c, /** * pnode_lookup - lookup a pnode in the LPT. * @c: UBIFS file-system description object - * @i: pnode number (0 to main_lebs - 1) + * @i: pnode number (0 to (main_lebs - 1) / UBIFS_LPT_FANOUT)) * * This function returns a pointer to the pnode on success or a negative * error code on failure. -- cgit v1.2.3