[LU-10503] Resource acquired to 'fd' at line 1251 may be lost in mirror_extend_file() Created: 12/Jan/18  Updated: 25/Jan/18  Resolved: 25/Jan/18

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

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

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   
static int mirror_extend_file(const char *fname, const char *victim_file, enum mirror_flags mirror_flags)
{
1251		fd = open(fname, O_RDWR);
1252		if (fd < 0) {...}
1257	 
1258		fdv = open(victim_file, O_RDWR);
1259		if (fdv < 0) {...}
1264	 
1265		if (fstat(fd, &stbuf) || fstat(fdv, &stbuf_v)) {...}
1270	 
1271		if (stbuf.st_dev != stbuf_v.st_dev) {...}
1276	 
1277		/* mirrors should be of the same size */
1278		if (stbuf.st_size != stbuf_v.st_size) {...}
1283	 
1284		rc = llapi_lease_get(fd, LL_LEASE_RDLCK);
1285		if (rc < 0) {...}
1289	 
1290		if (!(mirror_flags & NO_VERIFY)) {...}
1300
1301		/* Get rid of caching pages from clients */
1302		rc = llapi_get_data_version(fd, &dv, LL_DV_WR_FLUSH);
1303		if (rc < 0) {
1304			error_loc = "cannot get data version";
1305			return rc;
1306		}

TRACEBACK

An event which alters the program's state, leading to the defect
lfs.c:1251: Resource is acquired: 'fd' in the call to 'open'

An event which alters the program's state, leading to the defect
lfs.c:1305: Resource is lost: 'fd'

Resource acquired to 'fdv' at line 1258 may be lost here.
TRACEBACK

An event which alters the program's state, leading to the defect
lfs.c:1258: Resource is acquired: 'fdv' in the call to 'open'

An event which alters the program's state, leading to the defect
lfs.c:1305: Resource is lost: 'fdv'



 Comments   
Comment by Gerrit Updater [ 18/Jan/18 ]

Jian Yu (jian.yu@intel.com) uploaded a new patch: https://review.whamcloud.com/30914
Subject: LU-10503 flr: fix error handling in mirror_extend_file()
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8e984658919b70f095eb8e8e70f3559c24b989f2

Comment by Gerrit Updater [ 25/Jan/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30914/
Subject: LU-10503 flr: fix error handling in mirror_extend_file()
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 22d4926257cc774f514612f91a304a007dc14e63

Comment by Peter Jones [ 25/Jan/18 ]

Landed for 2.11

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