Wood on the enrty will help stop it, also find the end of the part of the carpet that has begun to unravel and cut it with a sharp knife or clip with a sissors and place a drop of glue on the end down ... read more
Looks like you could use help of a good plumber or handy man who knows how to work with PVC piping. It's not complicated job, but there are few technics to it. Hope it helps.