[LU-13581] LU-9859 libcfs: add support for Xarray breaks build on 3.10.0-1062.9.1.el7.x86_64.debug Created: 18/May/20  Updated: 04/Feb/21  Resolved: 05/Jul/20

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

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: Shaun Tancheff
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

When lockdep is enabled, the Xarray header cannot be compiled due to const qualification errors:

  CC [M]  /root/lustre-release/libcfs/libcfs/linux/xarray.o
In file included from /root/lustre-release/libcfs/libcfs/linux/xarray.c:19:0:
/root/lustre-release/libcfs/include/libcfs/linux/xarray.h: In function ‘xa_head’:
/root/lustre-release/libcfs/include/libcfs/linux/xarray.h:1135:2: error: passing argument 1 of ‘lock_is_held’ discards ‘const’ qualifier from pointer target type [-Werror]
  return rcu_dereference_check(xa->xa_head,
  ^
In file included from include/linux/spinlock_types.h:18:0,
                 from include/linux/spinlock.h:81,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/slab.h:12,
                 from /root/lustre-release/libcfs/libcfs/linux/xarray.c:17:
include/linux/lockdep.h:340:19: note: expected ‘struct lockdep_map *’ but argument is of type ‘const struct lockdep_map *’
 static inline int lock_is_held(struct lockdep_map *lock)
                   ^


 Comments   
Comment by James A Simmons [ 19/May/20 ]

Strange this doesn't show up in the linux kernel since it was taken from it.

Comment by John Hammond [ 20/May/20 ]

The signature of the lockdep functions changed sometime between 3.10 and 5.2. See https://elixir.bootlin.com/linux/v5.2-rc2/source/include/linux/lockdep.h#L354

Comment by Gerrit Updater [ 22/May/20 ]

James Simmons (jsimmons@infradead.org) uploaded a new patch: https://review.whamcloud.com/38696
Subject: LU-13581 libcfs: fixup Xarray support
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: afc399c9aa540928f755fb8a21455c51bb7bf353

Comment by Gerrit Updater [ 23/Jun/20 ]

Shaun Tancheff (shaun.tancheff@hpe.com) uploaded a new patch: https://review.whamcloud.com/39150
Subject: LU-13581 build: xarray and lockdep_is_held const clash
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 1902c60cf81363fb6635f4f5729d0874581e1b75

Comment by Gerrit Updater [ 05/Jul/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/39150/
Subject: LU-13581 build: xarray and lockdep_is_held const clash
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 3fcceea0e301c51a29d641c287bd36302a706bbe

Comment by Peter Jones [ 05/Jul/20 ]

Landed for 2.14

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