More than ‘a while’. https://pmc.ncbi.nlm.nih.gov/articles/PMC4344412/:
“In the mid 1970s smoking was allowed virtually everywhere; by 2000 there were only two allowable smoking areas-each approximately 6 feet by 6 feet-one in the engine room and one up forward.
[…]
In 2009, a working group was established to prepare for a December 31, 2010 deadline for prohibiting smoking below decks on deployed submarines”
That paper also says:
“In 1993, based on reports of the dangers of secondhand smoke, Captain Stanley W. Bryant, the commanding officer of the USS Theodore Roosevelt, announced a ban on smoking aboard the ship starting in July 1993 and proposed eliminating tobacco from the ship's store. These actions elicited a strong and swift tobacco industry response. As described by Offen et al., tobacco friendly members of Congress challenged the policies and enough pressure was generated to force the reversal of both the ban on smoking and the prohibition of cigarette sales aboard the ship”