Henri Lansbury's hat-trick helped Nottingham Forest to a 5-2 win over Barnsley to move them six points away from the relegation zone in the Sky Bet Championship.