I wanted the write to fail only for the bad sectors, but it was failing for all the sectors in the O_DIRECT mode, but I got a working program. (Well, working means, I was able to write to the sectors, but still could not get it to fail for the bad sectors).
As i had updated in my previous post, i had created a small program which writes to the sectors with O_DIRECT. I guess i might have made some mistake in my original O_DIRECT try. (lets leave it apart!
)
But, even with the O_DIRECT and O_SYNC flags in place, the write passes for all the bad sectors.
Is there anything that has be enabled / checked?
Thank you for the replies.