Do not use st_dev to find common path prefix

Ticket:	#5579