Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a18a46dd authored by Andrew Perepechko's avatar Andrew Perepechko Committed by Greg Kroah-Hartman
Browse files

staging/lustre/llite: drop_caches hangs in cl_inode_fini()



This patch releases cl_pages on error in ll_write_begin()
to avoid memory and object reference leaks. Also, it
reuses per-cpu lu_env in ll_invalidatepage() in the same
way as done in ll_releasepage().

Signed-off-by: default avatarAndrew Perepechko <andrew.perepechko@seagate.com>
Seagate-bug-id: MRP-3504
Reviewed-on: http://review.whamcloud.com/22745
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8509


Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a763e916
Loading
Loading
Loading
Loading
+19 −17
Original line number Original line Diff line number Diff line
@@ -71,8 +71,6 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
	struct cl_page   *page;
	struct cl_page   *page;
	struct cl_object *obj;
	struct cl_object *obj;


	int refcheck;

	LASSERT(PageLocked(vmpage));
	LASSERT(PageLocked(vmpage));
	LASSERT(!PageWriteback(vmpage));
	LASSERT(!PageWriteback(vmpage));


@@ -82,8 +80,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
	 * happening with locked page too
	 * happening with locked page too
	 */
	 */
	if (offset == 0 && length == PAGE_SIZE) {
	if (offset == 0 && length == PAGE_SIZE) {
		env = cl_env_get(&refcheck);
		/* See the comment in ll_releasepage() */
		if (!IS_ERR(env)) {
		env = cl_env_percpu_get();
		LASSERT(!IS_ERR(env));
		inode = vmpage->mapping->host;
		inode = vmpage->mapping->host;
		obj = ll_i2info(inode)->lli_clob;
		obj = ll_i2info(inode)->lli_clob;
		if (obj) {
		if (obj) {
@@ -95,8 +94,7 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
		} else {
		} else {
			LASSERT(vmpage->private == 0);
			LASSERT(vmpage->private == 0);
		}
		}
			cl_env_put(env, &refcheck);
		cl_env_percpu_put(env);
		}
	}
	}
}
}


@@ -466,9 +464,9 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
			  struct page **pagep, void **fsdata)
			  struct page **pagep, void **fsdata)
{
{
	struct ll_cl_context *lcc;
	struct ll_cl_context *lcc;
	const struct lu_env  *env;
	const struct lu_env *env = NULL;
	struct cl_io   *io;
	struct cl_io   *io;
	struct cl_page *page;
	struct cl_page *page = NULL;
	struct cl_object *clob = ll_i2info(mapping->host)->lli_clob;
	struct cl_object *clob = ll_i2info(mapping->host)->lli_clob;
	pgoff_t index = pos >> PAGE_SHIFT;
	pgoff_t index = pos >> PAGE_SHIFT;
	struct page *vmpage = NULL;
	struct page *vmpage = NULL;
@@ -556,6 +554,10 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
			unlock_page(vmpage);
			unlock_page(vmpage);
			put_page(vmpage);
			put_page(vmpage);
		}
		}
		if (!IS_ERR_OR_NULL(page)) {
			lu_ref_del(&page->cp_reference, "cl_io", io);
			cl_page_put(env, page);
		}
	} else {
	} else {
		*pagep = vmpage;
		*pagep = vmpage;
		*fsdata = lcc;
		*fsdata = lcc;