Perfect spin-filter and spin-valve in carbon atomic chains