[LU-8632] Address of function 'page_count' is used instead of a local variable Created: 21/Sep/16  Updated: 29/Sep/16  Resolved: 29/Sep/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.9.0

Type: Bug Priority: Minor
Reporter: Dmitry Eremin (Inactive) Assignee: Dmitry Eremin (Inactive)
Resolution: Fixed Votes: 0
Labels: kw

Issue Links:
Related
is related to LU-8135 sanity test_101g fails with 'not all ... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In the following commit

commit 7f2aae8d80a73de7408668bbe569d5f4d8553efe
Author: Jinshan Xiong <jinshan.xiong@intel.com>
Date:   Mon Sep 12 11:17:10 2016 -0700

    LU-8135 osc: limits the number of chunks in write RPC
    
    OSC has to make sure that it won't issue write RPCs with too many
    chunks otherwise it will casue ZFS to create transactions much
    bigger than DMU_MAX_ACCESS in size, which will end up with write
    failure.
    
    Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
    Change-Id: Ib68b09afca35c253ef0a6b569f64f555e08bd11b
    Reviewed-on: http://review.whamcloud.com/22369
    Tested-by: Jenkins
    Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
    Reviewed-by: Patrick Farrell <paf@cray.com>
    Tested-by: Maloo <hpdd-maloo@intel.com>
    Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

the local variable 'page_count' in osc_send_read_rpc() was removed:

-       unsigned int page_count = 0;

but ASSERT with this variable was not:

2171:	LASSERT(page_count > 0);


 Comments   
Comment by Gerrit Updater [ 21/Sep/16 ]

Dmitry Eremin (dmitry.eremin@intel.com) uploaded a new patch: http://review.whamcloud.com/22654
Subject: LU-8632 osc: remove of usage removed 'page_count' local variable
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 41818fd9249b3807de74ffe80dca715479d82e71

Comment by Jinshan Xiong (Inactive) [ 21/Sep/16 ]

Interesting - why wasn't this issue caught by compiler?

Comment by Oleg Drokin [ 21/Sep/16 ]

the'res a kernel function named page_count(), that checks the count of a page, so I guess it became unaliased now and we make sure it's never NULL

Comment by Jinshan Xiong (Inactive) [ 21/Sep/16 ]

indeed. thanks for explanation.

However, page_count() is defined as an inline function:

static inline int page_count(struct page *page)
{
        return atomic_read(&compound_head(page)->_count);
}

what would be the address of this function?

Comment by Oleg Drokin [ 24/Sep/16 ]

It would create a static instance and use that address I am sure. You can write a simple test case to see it in action, I guess.

Comment by Gerrit Updater [ 29/Sep/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/22654/
Subject: LU-8632 osc: remove of usage removed 'page_count' local variable
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: f2b457a063159e3ae6d4dfe3b86910b3d4e0d8b2

Generated at Sat Feb 10 02:19:14 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.