Inside the osd_dirent_check_repair(), if the logic comes to
"goto again", it only unlock the "hlock" but without seting
the variable @hlock as NULL. Althouth it will not cause any
logic failure, it may make the readers to be confused. This
patch will set "hlock = NULL;" explicitly to avoid trouble.
On the other hand, inside ldiskfs, the pdo lock users need
to check whether the lock handler is NULL or not properly.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I9db9dc758a2976849c299f76e06723e796da235d
Reviewed-on: http://review.whamcloud.com/16924
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
-+ if (!(ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
++ if (!(lck && ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
-+ if (!(ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
++ if (!(lck && ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
+ struct dx_entry *entries,
+ struct dx_entry *at, u32 hash)
+{
-+ if (!(ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
++ if (!(lck && ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
+ return DX_HASH_COL_IGNORE; /* don't care about collision */
+
+ } else if (at == entries + dx_get_count(entries) - 1) {
if (jh == NULL) {
brelse(bh);
if (jh == NULL) {
brelse(bh);
+ dev->od_dirent_journal = 1;
+ if (hlock != NULL) {
ldiskfs_htree_unlock(hlock);
ldiskfs_htree_unlock(hlock);
+ hlock = NULL;
+ } else {
up_read(&obj->oo_ext_idx_sem);
up_read(&obj->oo_ext_idx_sem);
- dev->od_dirent_journal = 1;
if (jh == NULL) {
brelse(bh);
if (jh == NULL) {
brelse(bh);
+ dev->od_dirent_journal = 1;
+ if (hlock != NULL) {
ldiskfs_htree_unlock(hlock);
ldiskfs_htree_unlock(hlock);
+ hlock = NULL;
+ } else {
up_read(&obj->oo_ext_idx_sem);
up_read(&obj->oo_ext_idx_sem);
- dev->od_dirent_journal = 1;
if (jh == NULL) {
brelse(bh);
if (jh == NULL) {
brelse(bh);
+ dev->od_dirent_journal = 1;
+ if (hlock != NULL) {
ldiskfs_htree_unlock(hlock);
ldiskfs_htree_unlock(hlock);
+ hlock = NULL;
+ } else {
up_read(&obj->oo_ext_idx_sem);
up_read(&obj->oo_ext_idx_sem);
- dev->od_dirent_journal = 1;